import { css } from '@emotion/react'; import { useTheme, theme, shadows, typography } from '@expo/styleguide'; import { borderRadius, breakpoints, spacing } from '@expo/styleguide-base'; import { ChevronDownIcon, Moon01SolidIcon, SunSolidIcon, Contrast02SolidIcon, } from '@expo/styleguide-icons'; import { useEffect, useState } from 'react'; export const ThemeSelector = () => { const { themeName, setAutoMode, setDarkMode, setLightMode } = useTheme(); const [isLoaded, setLoaded] = useState(false); useEffect(function didMount() { setLoaded(true); }, []); return (
{isLoaded && ( <> {themeName === 'auto' && } {themeName === 'dark' && } {themeName === 'light' && } )}
); }; const ICON_CLASSES = 'icon-sm absolute left-2.5 top-2.5 text-icon-secondary pointer-events-none'; const selectStyle = css` ${typography.fontSizes[14]} display: flex; align-items: center; justify-content: center; height: 36px; color: ${theme.text.default}; line-height: 1.3; padding: 0; width: 50px; margin: 0; border: 1px solid ${theme.border.default}; box-shadow: ${shadows.xs}; border-radius: ${borderRadius.md}px; -moz-appearance: none; -webkit-appearance: none; appearance: none; background-color: ${theme.background.default}; cursor: pointer; text-indent: -9999px; :hover { background-color: ${theme.background.element}; } :focus-visible { background-color: ${theme.background.element}; } @media screen and (max-width: ${(breakpoints.medium + breakpoints.large) / 2}px) { width: auto; min-width: 100px; padding: 0 ${spacing[2]}px; padding-left: ${spacing[8]}px; color: ${theme.text.secondary}; text-indent: 0; } `;