forked from b00tc4mp/isdi-parttime-202309
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement all filter options and refactor b00tc4mp#407
- Loading branch information
Showing
15 changed files
with
244 additions
and
128 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
65 changes: 61 additions & 4 deletions
65
staff/belen-ivars/project/app/src/components/ComplexityOptions.jsx
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 |
---|---|---|
@@ -1,6 +1,63 @@ | ||
import OptionsFilters from "./OptionsFilters" | ||
import { useState } from "react" | ||
|
||
export default function ComplexityOptions() { | ||
const options = ['very easy', 'easy', 'medium', 'complex', 'very complex'] | ||
return <OptionsFilters title="Complexity level" options={options} /> | ||
export default function ComplexityOptions(props) { | ||
const [isEasyChecked, setIsEasyChecked] = useState(false); | ||
const [isRegularChecked, setIsRegularChecked] = useState(false); | ||
const [isComplexChecked, setIsComplexChecked] = useState(false); | ||
|
||
const handleEasyOnChange = () => { | ||
setIsEasyChecked(!isEasyChecked); | ||
props.complexityChange('easy') | ||
}; | ||
|
||
const handleRegularOnChange = () => { | ||
setIsRegularChecked(!isRegularChecked); | ||
props.complexityChange('regular') | ||
}; | ||
|
||
const handleComplexOnChange = () => { | ||
setIsComplexChecked(!isComplexChecked); | ||
props.complexityChange('complex') | ||
}; | ||
|
||
return ( | ||
<div> | ||
Tria la complexitat de la recepta: | ||
<div className="flex flex-col"> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="easy" | ||
name="easy" | ||
value="Easy" | ||
checked={isEasyChecked} | ||
onChange={handleEasyOnChange} | ||
/> | ||
Fàcil | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="regular" | ||
name="regular" | ||
value="Regular" | ||
checked={isRegularChecked} | ||
onChange={handleRegularOnChange} | ||
/> | ||
Regular | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="complex" | ||
name="complex" | ||
value="Complex" | ||
checked={isComplexChecked} | ||
onChange={handleComplexOnChange} | ||
/> | ||
Complexa | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
124 changes: 107 additions & 17 deletions
124
staff/belen-ivars/project/app/src/components/MethodOptions.jsx
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 |
---|---|---|
@@ -1,24 +1,114 @@ | ||
import { Container } from "../library" | ||
import OptionsFilters from "./OptionsFilters" | ||
import { useState } from "react" | ||
|
||
export default function MethodOptions() { | ||
const [isOpen, setIsOpen] = useState(false) | ||
export default function MethodOptions(props) { | ||
const [isSteamedChecked, setIsSteamedChecked] = useState(false); | ||
const [isOvenChecked, setIsOvenChecked] = useState(false); | ||
const [isMicrowaveChecked, setIsMicrowaveChecked] = useState(false); | ||
const [isGrillChecked, setIsGrillChecked] = useState(false); | ||
const [isFreshChecked, setIsFreshChecked] = useState(false); | ||
const [isCookedChecked, setIsCookedChecked] = useState(false); | ||
|
||
const options = ['steamed', 'oven', 'microwave', 'grill', 'fresh', 'cook'] | ||
const handleSteamedOnChange = () => { | ||
setIsSteamedChecked(!isSteamedChecked); | ||
props.methodChange('steamed') | ||
}; | ||
|
||
function handleMethodlick(event) { | ||
event.preventDefault() | ||
const handleOvenOnChange = () => { | ||
setIsOvenChecked(!isOvenChecked); | ||
props.methodChange('oven') | ||
}; | ||
|
||
setIsOpen(!isOpen) | ||
const handleMicrowaveOnChange = () => { | ||
setIsMicrowaveChecked(!isMicrowaveChecked); | ||
props.methodChange('microwave') | ||
}; | ||
|
||
if (isOpen) { | ||
setIsOpen(false) | ||
} | ||
} | ||
return <Container className="options" onClick={handleMethodlick}> | ||
{isOpen && | ||
<OptionsFilters title="Method" options={options} /> | ||
} | ||
</Container> | ||
const handleGrillOnChange = () => { | ||
setIsGrillChecked(!isGrillChecked); | ||
props.methodChange('grill') | ||
}; | ||
|
||
const handleFreshOnChange = () => { | ||
setIsFreshChecked(!isFreshChecked); | ||
props.methodChange('fresh') | ||
}; | ||
|
||
const handleCookedOnChange = () => { | ||
setIsCookedChecked(!isCookedChecked); | ||
props.methodChange('cooked') | ||
}; | ||
|
||
return ( | ||
<div> | ||
Tria el mètode d'elaboració: | ||
<div className="flex flex-col"> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="steamed" | ||
name="steamed" | ||
value="Steamed" | ||
checked={isSteamedChecked} | ||
onChange={handleSteamedOnChange} | ||
/> | ||
Al vapor | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="oven" | ||
name="oven" | ||
value="Oven" | ||
checked={isOvenChecked} | ||
onChange={handleOvenOnChange} | ||
/> | ||
Forn | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="microwave" | ||
name="microwave" | ||
value="Microwave" | ||
checked={isMicrowaveChecked} | ||
onChange={handleMicrowaveOnChange} | ||
/> | ||
Microones | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="grill" | ||
name="grill" | ||
value="Grill" | ||
checked={isGrillChecked} | ||
onChange={handleGrillOnChange} | ||
/> | ||
Planxa | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="fresh" | ||
name="fresh" | ||
value="Fresh" | ||
checked={isFreshChecked} | ||
onChange={handleFreshOnChange} | ||
/> | ||
Fresc | ||
</div> | ||
<div> | ||
<input | ||
type="checkbox" | ||
id="cooked" | ||
name="cooked" | ||
value="Cooked" | ||
checked={isCookedChecked} | ||
onChange={handleCookedOnChange} | ||
/> | ||
Cuit | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.