Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-co committed May 7, 2024
1 parent 82f0905 commit 483a44e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
9 changes: 7 additions & 2 deletions React/test-feedback/src/components/feed/FeedForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import { Button } from '../shared/Button'
import { Card } from '../shared/Card'

export const FeedForm = (props) => {

const handleSubmit = (e) => {
e.preventDefault()
}

return (
<Card>
<form >
<form onSubmit={handleSubmit} >
<h2>How would you rate your service with us?</h2>
<FeedRating />
<div className="input-group">
Expand All @@ -16,7 +21,7 @@ export const FeedForm = (props) => {

placeholder="Write a review"
/>
<Button >
<Button type={'submit'} >
Send
</Button>
</div>
Expand Down
23 changes: 20 additions & 3 deletions React/test-feedback/src/components/feed/FeedRating.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
import React from 'react'
import React, { useState } from 'react'

export const FeedRating = (props) => {
const [rating, setRating] = useState()
const [selected, setSelected] = useState(10)

export const FeedRating = () => {
return (
<div>FeedRating</div>
<ul className='rating'>
{
Array.from({ length: 10 }, (_, i) => (
<li key={i}>
<input type="radio" value={i + 1} id={i + 1} checked={selected == i + 1} onChange={() => setSelected(i + 1)} />
<label htmlFor={i + 1}>{i + 1}</label>
</li>
)
)
}
</ul>
)
}

// FeedRating.defaultProps = {
// selected: 10
// }
8 changes: 5 additions & 3 deletions React/test-feedback/src/components/shared/Button.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react'

export const Button = () => {
export const Button = (props, { version = 'secondary', type = 'button' }) => {
return (
<div>Button</div>
<button type={type} disabled={props.isDisabled} className={`btn btn-${version}`}>
{props.children}
</button>
)
}
}

0 comments on commit 483a44e

Please sign in to comment.