diff --git a/package.json b/package.json index bb49e7e32..9a77244f7 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@faceless-ui/slider": "^2.0.0-beta.0", "@faceless-ui/window-info": "^3.0.0-beta.0", "@next/bundle-analyzer": "^13.4.2", + "@radix-ui/react-select": "^2.1.1", "@sentry/nextjs": "^7.80.1", "@splinetool/react-spline": "^2.2.6", "@splinetool/runtime": "^1.3.0", diff --git a/src/components/Footer/index.module.scss b/src/components/Footer/index.module.scss index bece38331..446429e9d 100644 --- a/src/components/Footer/index.module.scss +++ b/src/components/Footer/index.module.scss @@ -132,6 +132,7 @@ $curve: cubic-bezier(.165, 0.84, 0.44, 1); max-width: 100%; align-items: center; margin-bottom: 3rem; + z-index: 0; } .socialIconLink { @@ -188,13 +189,3 @@ $curve: cubic-bezier(.165, 0.84, 0.44, 1); position: absolute; margin-left: 1.25rem; } - -.themeIcon { - width: var(--theme-icon-width); -} - -.upDownChevronIcon { - width: var(--theme-switcher-icon-width); - right: 0.75rem; - pointer-events: none; -} diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 9c7213f7b..5b5a442af 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -15,12 +15,8 @@ import Payload3D from '@components/Payload3D/index.js' import { DiscordIcon } from '@root/graphics/DiscordIcon/index.js' import { FacebookIcon } from '@root/graphics/FacebookIcon/index.js' import { InstagramIcon } from '@root/graphics/InstagramIcon/index.js' -import { ThemeAutoIcon } from '@root/graphics/ThemeAutoIcon/index.js' -import { ThemeDarkIcon } from '@root/graphics/ThemeDarkIcon/index.js' -import { ThemeLightIcon } from '@root/graphics/ThemeLightIcon/index.js' import { TwitterIconAlt } from '@root/graphics/TwitterIconAlt/index.js' import { YoutubeIcon } from '@root/graphics/YoutubeIcon/index.js' -import { ChevronUpDownIcon } from '@root/icons/ChevronUpDownIcon/index.js' import { useHeaderObserver } from '@root/providers/HeaderIntersectionObserver/index.js' import { useThemePreference } from '@root/providers/Theme/index.js' import { getImplicitPreference, themeLocalStorageKey } from '@root/providers/Theme/shared.js' @@ -28,6 +24,7 @@ import { Theme } from '@root/providers/Theme/types.js' import { getCookie } from '@root/utilities/get-cookie.js' import classes from './index.module.scss' +import { SelectTheme } from '@components/SelectTheme' export const Footer: React.FC = props => { const { columns } = props @@ -300,32 +297,8 @@ export const Footer: React.FC = props => { -
- - {selectRef?.current && ( -
- {selectRef.current.value === 'auto' && } - {selectRef.current.value === 'light' && } - {selectRef.current.value === 'dark' && } -
- )} - - - - +
diff --git a/src/components/SelectTheme/index.module.scss b/src/components/SelectTheme/index.module.scss new file mode 100644 index 000000000..2f4b2c7d7 --- /dev/null +++ b/src/components/SelectTheme/index.module.scss @@ -0,0 +1,78 @@ +.themeIcons { + display: inline-flex; + height: 1rem; + justify-content: center; +} + +.themeIcon { + width: var(--theme-icon-width); +} + +.upDownChevronIcon { + width: var(--theme-switcher-icon-width); + right: 0.75rem; + pointer-events: none; +} + +.SelectTrigger { + position: relative; + display: inline-flex; + align-items: center; + padding: 1rem 1.5rem; + color: var(--theme-elevation-500); + font-size: 1rem; + line-height: 1.5; + width: 100%; + background-color: black; + border:1px solid var(--grid-line-dark); + cursor: pointer; +} + +.SelectContent { + display: inline-flex; + align-items: center; + justify-content: space-between; + color: var(--theme-elevation-500); + font-size: 1rem; + font-family: inherit; + background-color: black; + border:1px solid var(--grid-line-dark); + cursor: pointer; + z-index: 10; + +} + +.SelectItem { + font-size: 1rem; + padding: 1rem 1.5rem; + line-height: 1; + height: 35px; + padding: 8px 16px; + border:1px solid var(--grid-line-dark); + width: 90vw; + cursor: pointer; + + @media screen and (min-width: 600px) { + width: 95vw; + } + @media screen and (min-width: 800px) { + width: 46vw; + } + @media screen and (min-width: 1000px) { + width: 21vw; + } + +} + +.SelectItem[data-highlighted] { + outline: none; + background-color: rgb(178, 217, 231); +} + +.switcherIcon { + display: inline-flex; + height: 1rem; + justify-content: center; + position: absolute; + margin-left: 1.25rem; +} \ No newline at end of file diff --git a/src/components/SelectTheme/index.tsx b/src/components/SelectTheme/index.tsx new file mode 100644 index 000000000..e96ff92c2 --- /dev/null +++ b/src/components/SelectTheme/index.tsx @@ -0,0 +1,65 @@ +import React from 'react' + +import * as Select from '@radix-ui/react-select' +import classes from './index.module.scss' + +import { ThemeAutoIcon } from '@root/graphics/ThemeAutoIcon/index.js' +import { ThemeDarkIcon } from '@root/graphics/ThemeDarkIcon/index.js' +import { ThemeLightIcon } from '@root/graphics/ThemeLightIcon/index.js' +import { ChevronUpDownIcon } from '@root/icons/ChevronUpDownIcon/index.js' + +export const SelectTheme = ({ + themeId, + onThemeChange, +}: { + selectRef: any + themeId: string + onThemeChange: (e: string) => void +}) => { + const [selectedValue, setSelectedValue] = React.useState('auto') + const selectRef = React.useRef(null) + + const handleValueChange = value => { + setSelectedValue(value) + onThemeChange(value) + } + + return ( + + + {selectRef?.current && ( +
+ {selectedValue === 'auto' && } + {selectedValue === 'light' && } + {selectedValue === 'dark' && } +
+ )} + + + +
+ + + + + + + Auto + + + + Light + + + + Dark + + + + + + + +
+ ) +}