-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acdcf84
commit d6e07dd
Showing
4 changed files
with
168 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { UUID } from 'crypto'; | ||
import COLORS from '@/styles/colors'; | ||
import { Flex } from '@/styles/containers'; | ||
import { P1 } from '@/styles/text'; | ||
import { DropdownOption, PlantingTypeEnum, UserPlant } from '@/types/schema'; | ||
import CustomSelect from '../CustomSelect'; | ||
import DateInput from '../DateInput'; | ||
import { ReviewContainer } from './styles'; | ||
|
||
export default function ReviewAddDetails({ | ||
details, | ||
updateInput, | ||
plantDictionary, | ||
}: { | ||
details: Record<string, Partial<UserPlant>>; | ||
updateInput: (field: string, value: string, plant_id: UUID) => void; | ||
plantDictionary: Record<UUID, string>; | ||
}) { | ||
const plantingTypeOptions: DropdownOption<PlantingTypeEnum>[] = [ | ||
{ value: 'TRANSPLANT', label: 'Transplant' }, | ||
{ value: 'INDOORS', label: 'Indoors' }, | ||
{ value: 'OUTDOORS', label: 'Outdoors' }, | ||
]; | ||
|
||
return ( | ||
<ReviewContainer> | ||
{Object.entries(details).map(([plant_id, detail]) => ( | ||
<Flex $direction="column" $gap="8px" $mb="16px" key={plant_id}> | ||
<P1 $color={COLORS.shrub}>{plantDictionary[plant_id as UUID]}</P1> | ||
<CustomSelect | ||
label="Planting Type" | ||
value={detail.planting_type as string} | ||
options={plantingTypeOptions} | ||
onChange={value => | ||
updateInput('planting_type', value, plant_id as UUID) | ||
} | ||
/> | ||
<DateInput | ||
value={detail.date_added as string} | ||
onChange={value => | ||
updateInput('date_added', value, plant_id as UUID) | ||
} | ||
/> | ||
</Flex> | ||
))} | ||
</ReviewContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const ReviewContainer = styled.div` | ||
width: 100%; | ||
max-width: 500px; | ||
background-color: white; | ||
border-radius: 8px; | ||
padding: 1.5rem; | ||
justify-content: center; | ||
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); | ||
`; |