Merge pull request #938 from omnivore-app/fix/menu-and-modal-design

Clean up menus based on latest design
This commit is contained in:
Jackson Harper 2022-07-09 16:50:39 -07:00 committed by GitHub
commit 0f1c2f0656
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 89 additions and 44 deletions

View file

@ -181,14 +181,20 @@ export const Button = styled('button', {
}, },
themeSwitch: { themeSwitch: {
p: '0px', p: '0px',
m: '4px', m: '0px',
ml: '0px', ml: '0px',
width: '24px', width: '68px',
height: '24px', height: '52px',
fontSize: '14px', fontSize: '14px',
borderRadius: '4px', border: 'unset',
border: '1px solid rgb(243, 243, 243)', borderRadius: '6px',
'&:hover': { transform: 'scale(1.2)' } '&:hover': {
transform: 'scale(1.1)',
border: '2px solid #F9D354',
},
'&[data-state="selected"]': {
border: '2px solid #F9D354',
}
}, },
}, },
}, },

View file

@ -13,8 +13,10 @@ import { CSS } from '@stitches/react';
import { styled } from './../tokens/stitches.config' import { styled } from './../tokens/stitches.config'
const itemStyles = { const itemStyles = {
fontSize: 13, fontSize: '16px',
padding: '$2', fontWeight: 'semibold',
py: '12px',
px: '24px',
borderRadius: 3, borderRadius: 3,
cursor: 'default', cursor: 'default',
color: '$grayText', color: '$grayText',
@ -46,16 +48,61 @@ const StyledTriggerItem = styled(TriggerItem, {
}) })
export const DropdownContent = styled(Content, { export const DropdownContent = styled(Content, {
minWidth: 130, width: 195,
backgroundColor: '$grayBg', backgroundColor: '$grayBg',
borderRadius: '0.5em', borderRadius: '6px',
padding: 5, outline: '1px solid #323232',
outline: '1px solid $grayBorder', border: '1px solid $grayBorder',
boxShadow: '$cardBoxShadow', boxShadow: '$cardBoxShadow',
'--arrow-visibility': '',
'&[data-side="top"]': {
'--arrow-visibility': 'collapse',
},
'&[data-side="bottom"]': {
'--arrow-top': -13,
},
'&[data-align="start"]': {
'--arrow-before-left': '9px',
'--arrow-before-right': 'auto',
'--arrow-after-left': '10px',
'--arrow-after-right': 'auto',
},
'&[data-align="center"]': {
'--arrow-before-left': 'auto',
'--arrow-before-right': '90px',
'--arrow-after-left': 'auto',
'--arrow-after-right': '91px',
},
'&[data-align="end"]': {
'--arrow-before-left': 'auto',
'--arrow-before-right': '9px',
'--arrow-after-left': 'auto',
'--arrow-after-right': '10px',
},
'&:before': {
top: 'calc(var(--arrow-top) * 1px - 2px)',
left: 'var(--arrow-before-left)',
right: 'var(--arrow-before-right)',
border: '8px solid transparent',
borderBottomColor: '$grayBorder',
},
'&:after': {
top: 'calc(var(--arrow-top) * 1px)',
left: 'var(--arrow-after-left)',
right: 'var(--arrow-after-right)',
border: '7px solid transparent',
borderBottomColor: '$grayBg',
},
'&:before, &:after': {
visibility: 'var(--arrow-visibility)',
position: 'absolute',
display: 'inline-block',
content: '',
},
}) })
const StyledArrow = styled(Arrow, { const StyledArrow = styled(Arrow, {
fill: '$grayBg', visibility: 'hidden',
}) })
const StyledLabel = styled(Label, { const StyledLabel = styled(Label, {
@ -70,7 +117,6 @@ export type DropdownSide = 'top' | 'right' | 'bottom' | 'left'
type DropdownProps = { type DropdownProps = {
labelText?: string labelText?: string
showArrow?: boolean
triggerElement: React.ReactNode triggerElement: React.ReactNode
children: React.ReactNode children: React.ReactNode
styledArrow?: boolean styledArrow?: boolean
@ -101,7 +147,6 @@ export function DropdownOption(props: DropdownOptionProps): JSX.Element {
<StyledItem onSelect={props.onSelect}> <StyledItem onSelect={props.onSelect}>
{props.title ?? props.children} {props.title ?? props.children}
</StyledItem> </StyledItem>
{props.hideSeparator ? null : <DropdownSeparator />}
</> </>
) )
} }
@ -112,7 +157,6 @@ export function Dropdown(props: DropdownProps & PopperContentProps): JSX.Element
align, align,
triggerElement, triggerElement,
labelText, labelText,
showArrow = true,
disabled = false, disabled = false,
side = 'bottom', side = 'bottom',
sideOffset = 0, sideOffset = 0,
@ -136,7 +180,7 @@ export function Dropdown(props: DropdownProps & PopperContentProps): JSX.Element
> >
{labelText && <StyledLabel>{labelText}</StyledLabel>} {labelText && <StyledLabel>{labelText}</StyledLabel>}
{children} {children}
{showArrow && <StyledArrow offset={20} width={20} height={10} />} <StyledArrow />
</DropdownContent> </DropdownContent>
</Root> </Root>
) )

View file

@ -204,7 +204,6 @@ export default function ExtensionsInstallHelp({
}} }}
> >
<Dropdown <Dropdown
showArrow={false}
triggerElement={ triggerElement={
<HStack <HStack
css={{ css={{

View file

@ -131,12 +131,14 @@ const textVariants = {
fontSize: '14px', fontSize: '14px',
}, },
menuTitle: { menuTitle: {
fontSize: 13,
pt: '0px', pt: '0px',
m: '0px', m: '0px',
borderRadius: 3,
cursor: 'default', cursor: 'default',
color: '$grayText' color: '$grayText',
fontSize: 16,
fontFamily: 'inter',
fontWeight: '500',
lineHeight: 'unset',
}, },
error: { error: {
color: '$error', color: '$error',

View file

@ -8,6 +8,7 @@ import {
import { StyledText } from '../elements/StyledText' import { StyledText } from '../elements/StyledText'
import { Button } from '../elements/Button' import { Button } from '../elements/Button'
import { currentThemeName } from '../../lib/themeUpdater' import { currentThemeName } from '../../lib/themeUpdater'
import { Check } from 'phosphor-react'
export type HeaderDropdownAction = export type HeaderDropdownAction =
| 'apply-darker-theme' | 'apply-darker-theme'
@ -39,32 +40,37 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
return ( return (
<Dropdown triggerElement={props.triggerElement}> <Dropdown triggerElement={props.triggerElement}>
<VStack css={{ p: '$2' }}> <VStack css={{ py: '12px', px: '24px' }}>
<StyledText style="menuTitle">Theme</StyledText> <StyledText style="menuTitle">Theme</StyledText>
<HStack css={{ mt: '6px', mb: '6px', width: '100%', gap: '8px' }}> <HStack css={{ py: '8px', width: '100%', gap: '8px' }}>
<Button <Button
style="themeSwitch" style="themeSwitch"
css={{ background: '#FFFFFF', width: '50%' }} css={{ background: '#FFFFFF' }}
data-state={isDark ? 'unselected' : 'selected' }
onClick={() => { onClick={() => {
props.actionHandler('apply-lighter-theme') props.actionHandler('apply-lighter-theme')
setCurrentTheme(currentThemeName()) setCurrentTheme(currentThemeName())
}} }}
> >
{isDark ? '' : '✓'} {!isDark && (
<Check color='#F9D354' size={32} />
)}
</Button> </Button>
<Button <Button
style="themeSwitch" style="themeSwitch"
css={{ background: '#3D3D3D', width: '50%' }} css={{ background: '#3D3D3D' }}
data-state={isDark ? 'selected' : 'unselected' }
onClick={() => { onClick={() => {
props.actionHandler('apply-dark-theme') props.actionHandler('apply-dark-theme')
setCurrentTheme(currentThemeName()) setCurrentTheme(currentThemeName())
}} }}
> >
{isDark ? '✓' : ''} {isDark && (
<Check color='#F9D354' size={32} />
)}
</Button> </Button>
</HStack> </HStack>
</VStack> </VStack>
<DropdownSeparator />
<DropdownOption <DropdownOption
onSelect={() => props.actionHandler('navigate-to-install')} onSelect={() => props.actionHandler('navigate-to-install')}
title="Install" title="Install"
@ -77,10 +83,6 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
onSelect={() => props.actionHandler('navigate-to-labels')} onSelect={() => props.actionHandler('navigate-to-labels')}
title="Labels" title="Labels"
/> />
<DropdownOption
onSelect={() => props.actionHandler('navigate-to-api')}
title="API Keys"
/>
{/* <DropdownOption {/* <DropdownOption
onSelect={() => props.actionHandler('navigate-to-subscriptions')} onSelect={() => props.actionHandler('navigate-to-subscriptions')}
title="Subscriptions" title="Subscriptions"
@ -92,7 +94,6 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
<DropdownOption <DropdownOption
onSelect={() => props.actionHandler('logout')} onSelect={() => props.actionHandler('logout')}
title="Logout" title="Logout"
hideSeparator
/> />
</Dropdown> </Dropdown>
) )

View file

@ -42,7 +42,6 @@ type ActionDropdownProps = {
const ActionDropdown = (props: ActionDropdownProps): JSX.Element => { const ActionDropdown = (props: ActionDropdownProps): JSX.Element => {
return <Dropdown return <Dropdown
showArrow={true}
css={{ m: '0px', p: '0px', overflow: 'hidden', width: '265px', maxWidth: '265px', '@smDown': { width: '230px' } }} css={{ m: '0px', p: '0px', overflow: 'hidden', width: '265px', maxWidth: '265px', '@smDown': { width: '230px' } }}
side={props.layout == 'side' ? 'right' : 'bottom'} side={props.layout == 'side' ? 'right' : 'bottom'}
sideOffset={props.layout == 'side' ? 8 : 0} sideOffset={props.layout == 'side' ? 8 : 0}

View file

@ -171,27 +171,22 @@ export function DropdownFilterMenu(
<DropdownOption <DropdownOption
onSelect={() => props.onFilterChange('in:archive')} onSelect={() => props.onFilterChange('in:archive')}
title="Archived" title="Archived"
hideSeparator
/> />
<DropdownOption <DropdownOption
onSelect={() => props.onFilterChange('type:file')} onSelect={() => props.onFilterChange('type:file')}
title="Files" title="Files"
hideSeparator
/> />
<DropdownOption <DropdownOption
onSelect={() => props.onFilterChange('type:highlights')} onSelect={() => props.onFilterChange('type:highlights')}
title="Highlights" title="Highlights"
hideSeparator
/> />
<DropdownOption <DropdownOption
onSelect={() => props.onFilterChange(`saved:${recentlySavedStartDate}`)} onSelect={() => props.onFilterChange(`saved:${recentlySavedStartDate}`)}
title="Recently Saved" title="Recently Saved"
hideSeparator
/> />
<DropdownOption <DropdownOption
onSelect={() => props.onFilterChange(`sort:read`)} onSelect={() => props.onFilterChange(`sort:read`)}
title="Recently Read" title="Recently Read"
hideSeparator
/> />
</Dropdown> </Dropdown>
) )

View file

@ -102,7 +102,7 @@ export const { styled, css, theme, getCssText, globalCss, keyframes, config } =
borderStyles: {}, borderStyles: {},
shadows: { shadows: {
panelShadow: '0px 4px 18px rgba(120, 123, 134, 0.12)', panelShadow: '0px 4px 18px rgba(120, 123, 134, 0.12)',
cardBoxShadow: '0px 0px 4px 0px rgba(0, 0, 0, 0.1)', cardBoxShadow: '0px 16px 25px 16px rgba(32, 31, 29, 0.1)',
}, },
zIndices: {}, zIndices: {},
transitions: {}, transitions: {},
@ -111,7 +111,7 @@ export const { styled, css, theme, getCssText, globalCss, keyframes, config } =
grayBase: '#F8F8F8', grayBase: '#F8F8F8',
grayBg: '#FFFFFF', grayBg: '#FFFFFF',
grayBgActive: '#e6e6e6', grayBgActive: '#e6e6e6',
grayBorder: 'rgba(0, 0, 0, 0.06)', grayBorder: '#F0F0F0',
grayTextContrast: '#3A3939', grayTextContrast: '#3A3939',
graySolid: '#9C9B9A', graySolid: '#9C9B9A',
@ -172,12 +172,11 @@ export const { styled, css, theme, getCssText, globalCss, keyframes, config } =
const darkThemeSpec = { const darkThemeSpec = {
colors: { colors: {
// Grayscale (top ones have been updated from new designs)
grayBase: '#252525', grayBase: '#252525',
grayBg: '#3B3938', grayBg: '#3B3938',
grayBgActive: '#4f4d4c', grayBgActive: '#4f4d4c',
grayTextContrast: '#D8D7D7', grayTextContrast: '#D8D7D7',
grayBorder: 'rgba(255, 255, 255, 0.06)', grayBorder: '#323232',
graySolid: '#9C9B9A', graySolid: '#9C9B9A',
grayBgSubtle: 'hsl(0 0% 9.8%)', grayBgSubtle: 'hsl(0 0% 9.8%)',
@ -213,7 +212,7 @@ const darkThemeSpec = {
}, },
shadows: { shadows: {
cardBoxShadow: cardBoxShadow:
'0px 0px 9px -2px rgba(255, 255, 255, 0.09), 0px 7px 12px rgba(255, 255, 255, 0.07)', '0px 0px 9px -2px rgba(5, 5, 5, 0.16), 0px 7px 12px rgba(0, 0, 0, 0.13)',
}, },
} }