diff --git a/components/RaidSelect/index.module.scss b/components/RaidSelect/index.module.scss deleted file mode 100644 index e6eaa60f..00000000 --- a/components/RaidSelect/index.module.scss +++ /dev/null @@ -1,22 +0,0 @@ -.Raid.Select { - min-width: 420px; - - .Top { - display: flex; - flex-direction: column; - gap: $unit; - padding: $unit 0; - - .SegmentedControl { - width: 100%; - } - - .Input.Bound { - background-color: var(--select-contained-bg); - - &:hover { - background-color: var(--select-contained-bg-hover); - } - } - } -} diff --git a/components/RaidSelect/index.tsx b/components/RaidSelect/index.tsx deleted file mode 100644 index 7f3fd28e..00000000 --- a/components/RaidSelect/index.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import React, { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import * as RadixSelect from '@radix-ui/react-select' -import classNames from 'classnames' - -import Overlay from '~components/common/Overlay' - -import ChevronIcon from '~public/icons/Chevron.svg' - -import styles from './index.module.scss' -import SegmentedControl from '~components/common/SegmentedControl' -import Segment from '~components/common/Segment' -import Input from '~components/common/Input' - -// Props -interface Props - extends React.DetailedHTMLProps< - React.SelectHTMLAttributes, - HTMLSelectElement - > { - altText?: string - currentSegment: number - iconSrc?: string - open: boolean - trigger?: React.ReactNode - children?: React.ReactNode - onOpenChange?: () => void - onValueChange?: (value: string) => void - onSegmentClick: (segment: number) => void - onClose?: () => void - triggerClass?: string - overlayVisible?: boolean -} - -const RaidSelect = React.forwardRef(function Select( - props: Props, - forwardedRef -) { - // Import translations - const { t } = useTranslation('common') - - const searchInput = React.createRef() - - const [open, setOpen] = useState(false) - const [value, setValue] = useState('') - const [query, setQuery] = useState('') - - const triggerClasses = classNames( - { - SelectTrigger: true, - Disabled: props.disabled, - }, - props.triggerClass - ) - - useEffect(() => { - setOpen(props.open) - }, [props.open]) - - useEffect(() => { - if (props.value && props.value !== '') setValue(`${props.value}`) - else setValue('') - }, [props.value]) - - function onValueChange(newValue: string) { - setValue(`${newValue}`) - if (props.onValueChange) props.onValueChange(newValue) - } - - function onCloseAutoFocus() { - setOpen(false) - if (props.onClose) props.onClose() - } - - function onEscapeKeyDown() { - setOpen(false) - if (props.onClose) props.onClose() - } - - function onPointerDownOutside() { - setOpen(false) - if (props.onClose) props.onClose() - } - - return ( - - - {props.iconSrc ? {props.altText} : ''} - - {!props.disabled ? ( - - - - ) : ( - '' - )} - - - - <> - - - -
- {}} - /> - - props.onSegmentClick(1)} - > - {t('raids.sections.events')} - - props.onSegmentClick(0)} - > - {t('raids.sections.raids')} - - props.onSegmentClick(2)} - > - {t('raids.sections.solo')} - - -
- {props.children} -
- -
-
- ) -}) - -RaidSelect.defaultProps = { - overlayVisible: true, -} - -export default RaidSelect diff --git a/components/raids/RaidCombobox/index.module.scss b/components/raids/RaidCombobox/index.module.scss index 6ca520ba..96b267b6 100644 --- a/components/raids/RaidCombobox/index.module.scss +++ b/components/raids/RaidCombobox/index.module.scss @@ -1,8 +1,8 @@ -.Combobox.Raid { +.combobox.raid { box-sizing: border-box; min-width: 440px; - .Header { + .header { background: var(--dialog-bg); border-top-left-radius: $card-corner; border-top-right-radius: $card-corner; @@ -13,7 +13,64 @@ padding: $unit; width: 100%; - .Clear.Button { + .input { + -webkit-font-smoothing: antialiased; + background-color: var(--input-bound-bg); + border: 2px solid transparent; + border-radius: $input-corner; + box-sizing: border-box; + display: block; + width: 100%; + + &:not(.wrapper) { + padding: $unit * 1.5 $unit-2x; + } + + &.wrapper { + $offset: 2px; + + align-items: center; + background: var(--input-bg); + border-radius: $input-corner; + border: $offset solid transparent; + box-sizing: border-box; + position: relative; + + .counter { + color: var(--text-tertiary); + display: block; + font-weight: $bold; + line-height: 42px; + position: absolute; + right: $unit-2x; + top: 0; + } + + input { + background: transparent; + border-radius: $input-corner; + border: none; + box-sizing: border-box; + padding: $unit * 1.5 $unit-2x; + width: 100%; + } + } + + &:focus { + border: 2px solid $blue; + outline: none; + } + + &.bound { + background-color: var(--input-bound-bg); + + &:hover { + background-color: var(--input-bound-bg-hover); + } + } + } + + .clear.button { background: none; padding: ($unit * 0.75) $unit-half $unit-half; display: none; @@ -33,7 +90,7 @@ } } - .Controls { + .controls { display: flex; gap: $unit; @@ -48,25 +105,13 @@ width: auto; } } - - .Flipped { - transform: rotate(180deg); - } - - .SegmentedControlWrapper { - flex-grow: 1; - - .SegmentedControl { - width: 100%; - } - } } } - .Raids { + .raids { border-bottom-left-radius: $card-corner; border-bottom-right-radius: $card-corner; - height: 36vh; + height: 28vh; overflow-y: scroll; padding: 0 $unit; @@ -75,30 +120,30 @@ } &.Searching { - .CommandGroup { + .group { padding-top: 0; padding-bottom: 0; - .Label { + .label { display: none; } - .SelectItem { + .item { margin: 0; } } - .CommandGroup.Hidden { + .group.hidden { display: block; } } - .CommandGroup { - &.Hidden { + .group { + &.hidden { display: none; } - .Label { + .label { align-items: center; color: var(--text-tertiary); display: flex; @@ -109,7 +154,7 @@ gap: $unit; padding: $unit $unit-2x $unit-half ($unit * 1.5); - .Separator { + .separator { background: var(--select-separator); border-radius: 1px; display: block; @@ -121,67 +166,53 @@ } } -.trigger { - background: var(--input-bound-bg); +.info { display: flex; - padding-top: 10px; - padding-bottom: 11px; - min-height: 51px; + align-items: center; + gap: $unit-half; + flex-grow: 1; +} - .value { - display: flex; - gap: $unit-half; - width: 100%; +.extraIndicator { + background: var(--extra-purple-secondary); + border-radius: $full-corner; + color: $grey-100; + display: flex; + font-weight: $bold; + font-size: $font-tiny; + width: $unit-3x; + height: $unit-3x; + justify-content: center; + align-items: center; +} - .info { - display: flex; - align-items: center; - gap: $unit-half; - flex-grow: 1; - } +.group, +.separator { + color: var(--text-tertiary); +} - .extraIndicator { - background: var(--extra-purple-secondary); - border-radius: $full-corner; - color: $grey-100; - display: flex; - font-weight: $bold; - font-size: $font-tiny; - width: $unit-3x; - height: $unit-3x; - justify-content: center; - align-items: center; - } +.raid.wind { + color: var(--wind-text); +} - .Group, - .Separator { - color: var(--text-tertiary); - } +.raid.fire { + color: var(--fire-text); +} - .Raid.wind { - color: var(--wind-text); - } +.raid.water { + color: var(--water-text); +} - .Raid.fire { - color: var(--fire-text); - } +.raid.earth { + color: var(--earth-text); +} - .Raid.water { - color: var(--water-text); - } +.raid.dark { + color: var(--dark-text); +} - .Raid.earth { - color: var(--earth-text); - } - - .Raid.dark { - color: var(--dark-text); - } - - .Raid.light { - color: var(--light-text); - } - } +.raid.light { + color: var(--light-text); } .SelectTrigger.Raid:not(.Highlighted) .Value.Empty { diff --git a/components/raids/RaidCombobox/index.tsx b/components/raids/RaidCombobox/index.tsx index 70d617c0..e1b243b4 100644 --- a/components/raids/RaidCombobox/index.tsx +++ b/components/raids/RaidCombobox/index.tsx @@ -95,6 +95,17 @@ const RaidCombobox = (props: Props) => { const inputRef = createRef() const sortButtonRef = createRef() + // Classes + const comboboxClasses = classNames({ + [styles.combobox]: true, + [styles.raid]: true, + }) + + const raidsClasses = classNames({ + [styles.raids]: true, + [styles.searching]: query !== '', + }) + // ---------------------------------------------- // Methods: Lifecycle Hooks // ---------------------------------------------- @@ -313,14 +324,14 @@ const RaidCombobox = (props: Props) => { const options = generateRaidItems(group.raids) const groupClassName = classNames({ - CommandGroup: true, - Hidden: group.section !== currentSection, + [styles.group]: true, + [styles.hidden]: group.section !== currentSection, }) const heading = ( -
+
{group.name[locale]} -
+
) @@ -350,7 +361,7 @@ const RaidCombobox = (props: Props) => { @@ -379,7 +390,7 @@ const RaidCombobox = (props: Props) => { return ( { // Renders a SegmentedControl component for selecting raid sections. function renderSegmentedControl() { return ( - + { >