diff --git a/components/FilterBar/index.scss b/components/FilterBar/index.scss new file mode 100644 index 00000000..05ac2d33 --- /dev/null +++ b/components/FilterBar/index.scss @@ -0,0 +1,38 @@ +.FilterBar { + align-items: center; + background: white; + border-radius: 6px; + display: flex; + flex-direction: row; + gap: $unit * 2; + margin: 0 auto; + padding: $unit * 2; + position: sticky; + transition: box-shadow 0.24s ease-in-out; + top: $unit * 4; + width: 966px; + + &.shadow { + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14); + } + + h1 { + color: $grey-50; + font-size: $font-regular; + font-weight: $normal; + flex-grow: 1; + text-align: left; + } + + select { + background: url('/icons/Arrow.svg'), $grey-90; + background-repeat: no-repeat; + background-position-y: center; + background-position-x: 98%; + background-size: $unit * 1.5; + color: $grey-50; + font-size: $font-small; + margin: 0; + max-width: 200px; + } +} \ No newline at end of file diff --git a/components/FilterBar/index.tsx b/components/FilterBar/index.tsx new file mode 100644 index 00000000..daf89c9d --- /dev/null +++ b/components/FilterBar/index.tsx @@ -0,0 +1,63 @@ +import React from 'react' +import classNames from 'classnames' + +import RaidDropdown from '~components/RaidDropdown' + +import './index.scss' + +interface Props { + name: string + scrolled: boolean + onFilter: (element?: number, raid?: string, recency?: number) => void +} + +const FilterBar = (props: Props) => { + const elementSelect = React.createRef() + const raidSelect = React.createRef() + const recencySelect = React.createRef() + + const classes = classNames({ + 'FilterBar': true, + 'shadow': props.scrolled + }) + + function selectChanged(event: React.ChangeEvent) { + const elementValue = (elementSelect.current) ? parseInt(elementSelect.current.value) : -1 + const raidValue = (raidSelect.current) ? raidSelect.current.value : '' + const recencyValue = (recencySelect.current) ? parseInt(recencySelect.current.value) : -1 + + props.onFilter(elementValue, raidValue, recencyValue) + } + + return ( +
+

{props.name}

+ + + +
+ ) +} + +export default FilterBar