Skip to content

Commit

Permalink
chore: only the stars were left on the form
Browse files Browse the repository at this point in the history
  • Loading branch information
Franqsanz committed Sep 12, 2024
1 parent 0af6e0e commit 0da52a7
Showing 1 changed file with 11 additions and 31 deletions.
42 changes: 11 additions & 31 deletions src/components/forms/NewBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ export function FormNewBook() {
handleImage(e, setCropData, onOpen);
}

// function handleRatingChange(newRating: number) {
// setBooks((books) => ({
// ...books,
// rating: newRating,
// }));
// }
function handleRatingChange(newRating: number) {
setBooks((books) => ({
...books,
rating: newRating,
}));
}

function getCropData() {
getCrop(crop, setPreviewImg, books, setBooks, onClose);
Expand Down Expand Up @@ -551,7 +551,7 @@ export function FormNewBook() {
placeholder='Elija un Formato'
/>
</FormControl>
<FormControl mt={{ base: 5, md: 7 }}>
<FormControl mt={{ base: 5, md: 8 }}>
<Flex align='center' mb='9px'>
<FormLabel htmlFor='categoria' m='0'>
Calificación{' '}
Expand All @@ -560,31 +560,11 @@ export function FormNewBook() {
</Box>
</FormLabel>
</Flex>
<Select
id='rating'
name='rating'
size={{ base: 'md', md: 'lg' }}
variant='filled'
onChange={(selectedOption) =>
handleFieldChange('rating', selectedOption?.value)
}
options={[
{ value: 0, label: 0 },
{ value: 1, label: 1 },
{ value: 1.5, label: 1.5 },
{ value: 2, label: 2 },
{ value: 2.5, label: 2.5 },
{ value: 3, label: 3 },
{ value: 3.5, label: 3.5 },
{ value: 4, label: 4 },
{ value: 4.5, label: 4.5 },
{ value: 5, label: 5 },
]}
placeholder='Elija una Calificación'
<Rating
style={{ maxWidth: 190 }}
value={books.rating}
onChange={handleRatingChange}
/>
<Box mt='3.5'>
<Rating style={{ maxWidth: 190 }} value={books.rating} readOnly />
</Box>
</FormControl>
<Box mt={{ base: 10, md: '22rem' }}>
<Button
Expand Down

0 comments on commit 0da52a7

Please sign in to comment.