Skip to content

Commit

Permalink
Moves term selector (#496)
Browse files Browse the repository at this point in the history
* moved dropdown

* thicken border

* fix

* fill color on hover

* change on focus

* Update TermSelect.tsx
  • Loading branch information
liamshatzel authored Aug 16, 2023
1 parent cc8ade1 commit cf469bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/common/header/components/TermSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,23 @@ export function TermSelect(): JSX.Element {
}
};

let colorMap: { [key: string]: string } = {};
colorMap['09'] = mode('green.300', 'green.500');
colorMap['01'] = mode('blue.300', 'blue.500');
colorMap['05'] = mode('yellow.300', 'yellow.500');

// TODO: A "bug" in Firefox for macOS is preventing the `option` components
// from inheriting the `Select` background color this leads to eligible text in the options.
// from inheriting the `Select` background color this leads to illegible text in the options.
return (
<Select borderColor={mode('green.500', 'green.300')} value={selectedTerm} onChange={onChange} minW="150px">
<Select
borderColor={colorMap[selectedTerm.slice(-2)]}
value={selectedTerm}
onChange={onChange}
minW="150px"
borderWidth="2px"
_hover={{ bgColor: colorMap[selectedTerm.slice(-2)] }}
_focus={{ borderColor: colorMap[selectedTerm.slice(-2)] }}
>
{terms.map((term, i) => {
return (
<option key={i} value={term}>
Expand Down
6 changes: 4 additions & 2 deletions src/common/header/containers/HeaderContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ export function HeaderContainer({ onSearchChange }: HeaderProps): JSX.Element {
</Text>
</LinkBox>
<Search onChange={onSearchChange} />
<NavButtons />
<Spacer />
<HStack>
<TermSelect />
</HStack>
<Spacer />
<NavButtons />
<HStack>
<MiscHeaderButtons />
</HStack>
</HStack>
Expand Down

0 comments on commit cf469bf

Please sign in to comment.