diff --git a/components/DialogContent/index.scss b/components/DialogContent/index.scss index 26421dbf..1d8f9202 100644 --- a/components/DialogContent/index.scss +++ b/components/DialogContent/index.scss @@ -171,6 +171,11 @@ width: 100%; } } + + &.Spaced { + justify-content: space-between; + width: 100%; + } } } diff --git a/components/FilterBar/index.scss b/components/FilterBar/index.scss index e7e074c0..40c74006 100644 --- a/components/FilterBar/index.scss +++ b/components/FilterBar/index.scss @@ -38,6 +38,19 @@ flex-direction: column; width: 100%; } + + .Button.Filter.Blended { + &:hover { + background: var(--button-bg); + } + + .Accessory svg { + fill: none; + stroke: var(--button-text); + width: 18px; + height: 18px; + } + } } &.shadow { diff --git a/components/FilterBar/index.tsx b/components/FilterBar/index.tsx index 426dd856..b784d4a2 100644 --- a/components/FilterBar/index.tsx +++ b/components/FilterBar/index.tsx @@ -2,11 +2,15 @@ import React, { useState } from 'react' import { useTranslation } from 'next-i18next' import classNames from 'classnames' +import FilterModal from '~components/FilterModal' import RaidDropdown from '~components/RaidDropdown' - -import './index.scss' import Select from '~components/Select' import SelectItem from '~components/SelectItem' +import Button from '~components/Button' + +import FilterIcon from '~public/icons/Filter.svg' + +import './index.scss' interface Props { children: React.ReactNode @@ -32,6 +36,8 @@ const FilterBar = (props: Props) => { const [recencyOpen, setRecencyOpen] = useState(false) const [elementOpen, setElementOpen] = useState(false) + const [filterModalOpen, setFilterModalOpen] = useState(false) + // Set up classes object for showing shadow on scroll const classes = classNames({ FilterBar: true, @@ -66,81 +72,91 @@ const FilterBar = (props: Props) => { } return ( -
- {props.children} -
- + <> +
+ {props.children} +
+ - + - + + +
-
+ + ) } diff --git a/components/FilterModal/index.scss b/components/FilterModal/index.scss new file mode 100644 index 00000000..e69de29b diff --git a/components/FilterModal/index.tsx b/components/FilterModal/index.tsx new file mode 100644 index 00000000..e9a3ccf9 --- /dev/null +++ b/components/FilterModal/index.tsx @@ -0,0 +1,103 @@ +import React, { useEffect, useState } from 'react' +import { getCookie, setCookie } from 'cookies-next' +import { useRouter } from 'next/router' +import { useTranslation } from 'react-i18next' + +import { + Dialog, + DialogTrigger, + DialogClose, + DialogTitle, +} from '~components/Dialog' +import DialogContent from '~components/DialogContent' +import Button from '~components/Button' + +import type { DialogProps } from '@radix-ui/react-dialog' + +import CrossIcon from '~public/icons/Cross.svg' +import './index.scss' + +interface Props extends DialogProps {} + +const FilterModal = (props: Props) => { + // Set up router + const router = useRouter() + const locale = router.locale + + // Set up translation + const { t } = useTranslation('common') + + // Refs + const headerRef = React.createRef() + const footerRef = React.createRef() + + // States + const [filters, setFilters] = useState<{ [key: string]: any }>() + const [open, setOpen] = useState(false) + + // Hooks + useEffect(() => { + if (props.open !== undefined) setOpen(props.open) + }) + + function sendFilters() { + openChange() + } + + function openChange() { + if (open) { + setOpen(false) + if (props.onOpenChange) props.onOpenChange(false) + } else { + setOpen(true) + if (props.onOpenChange) props.onOpenChange(true) + } + } + + function onEscapeKeyDown(event: KeyboardEvent) { + event.preventDefault() + openChange() + } + + function onOpenAutoFocus(event: Event) { + event.preventDefault() + } + + return ( + + {props.children} + +
+
+ + {t('modals.filters.title')} + +
+ + + + + +
+
+
+
+
+
+
+
+
+
+ ) +} + +export default FilterModal diff --git a/public/icons/Filter.svg b/public/icons/Filter.svg new file mode 100644 index 00000000..e5b8036c --- /dev/null +++ b/public/icons/Filter.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/locales/en/common.json b/public/locales/en/common.json index c5070137..38e33002 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -206,6 +206,13 @@ "cancel": "Nevermind" } }, + "filters": { + "title": "Advanced filters", + "buttons": { + "confirm": "Save filters", + "clear": "Clear filters" + } + }, "login": { "title": "Log in", "buttons": { diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json index fb0ef587..ba3fb5d8 100644 --- a/public/locales/ja/common.json +++ b/public/locales/ja/common.json @@ -206,6 +206,13 @@ "cancel": "キャンセル" } }, + "filters": { + "title": "フィルター設定", + "buttons": { + "confirm": "フィルターを保存する", + "clear": "保存したフィルターをクリア" + } + }, "login": { "title": "ログイン", "buttons": {