Skip to content

Commit

Permalink
feat: disable origin buttons if blend is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
awang1245 committed Apr 2, 2024
1 parent 700d9c5 commit 17f0981
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ function App() {
onFilterRoast={onFilterRoast}
onFilterFlavor={onFilterFlavor}
onFilterOrigin={onFilterOrigin}
type={type}
sort={sort}
onSort={onSort}
/>
Expand Down
6 changes: 6 additions & 0 deletions src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface DropdownProps {
onFilterRoast: (event: React.ChangeEvent<HTMLInputElement>) => void;
onFilterFlavor: (event: React.ChangeEvent<HTMLInputElement>) => void;
onFilterOrigin: (event: React.ChangeEvent<HTMLInputElement>) => void;
type: string[];
sort: string;
onSort: (event: React.MouseEvent<HTMLButtonElement>) => void;
}
Expand All @@ -17,6 +18,7 @@ function Dropdown({
onFilterRoast,
onFilterFlavor,
onFilterOrigin,
type,
sort,
onSort,
}: DropdownProps) {
Expand Down Expand Up @@ -277,6 +279,7 @@ function Dropdown({
name="origin1"
value="africa"
onChange={onFilterOrigin}
disabled={type.length === 1 && type[0] === "blend"}
/>
<label htmlFor="origin1">africa</label>
</div>
Expand All @@ -288,6 +291,7 @@ function Dropdown({
name="origin2"
value="asia"
onChange={onFilterOrigin}
disabled={type.length === 1 && type[0] === "blend"}
/>
<label htmlFor="origin2">asia</label>
</div>
Expand All @@ -299,6 +303,7 @@ function Dropdown({
name="origin3"
value="central america"
onChange={onFilterOrigin}
disabled={type.length === 1 && type[0] === "blend"}
/>
<label htmlFor="origin3">central america</label>
</div>
Expand All @@ -310,6 +315,7 @@ function Dropdown({
name="origin4"
value="south america"
onChange={onFilterOrigin}
disabled={type.length === 1 && type[0] === "blend"}
/>
<label htmlFor="origin4">south america</label>
</div>
Expand Down
9 changes: 2 additions & 7 deletions src/styles/Dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,9 @@
user-select: none;
}

.container input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
input[disabled] {
outline: white;
}

.filter-accordion label {
font-size: 16px;
}

0 comments on commit 17f0981

Please sign in to comment.