Update design on Add Link, and notes modals

This commit is contained in:
Jackson Harper
2022-07-11 19:25:25 -07:00
parent 9e3b192506
commit 156c4cf2cf
6 changed files with 94 additions and 114 deletions

View File

@ -96,7 +96,7 @@ export function GeneralFormInput(props: FormInputProps): JSX.Element {
hidden={input.hidden} hidden={input.hidden}
required={input.required} required={input.required}
css={{ css={{
border: '1px solid $grayBorder', border: '1px solid $textNonessential',
borderRadius: '8px', borderRadius: '8px',
width: '100%', width: '100%',
bg: 'transparent', bg: 'transparent',

View File

@ -1,5 +1,9 @@
import { Root, Overlay, Content } from '@radix-ui/react-dialog' import { Root, Overlay, Content } from '@radix-ui/react-dialog'
import { X } from 'phosphor-react'
import { styled, keyframes, theme } from '../tokens/stitches.config' import { styled, keyframes, theme } from '../tokens/stitches.config'
import { Button } from './Button'
import { HStack } from './LayoutPrimitives'
import { StyledText } from './StyledText'
export const ModalRoot = styled(Root, {}) export const ModalRoot = styled(Root, {})
@ -44,3 +48,65 @@ export const ModalContent = styled(Modal, {
width: '95%', width: '95%',
}, },
}) })
export type ModalTitleBarProps = {
title: string
onOpenChange: (open: boolean) => void
}
export const ModalTitleBar = (props: ModalTitleBarProps) => {
return (
<HStack
distribution="between"
alignment="center"
css={{ height: '68px', width: '100%' }}
>
<StyledText style="modalHeadline" css={{ }}>
{props.title}
</StyledText>
<Button
css={{ ml: 'auto' }}
style="ghost"
onClick={() => {
props.onOpenChange(false)
}}
>
<X
size={24}
color={theme.colors.textNonessential.toString()}
/>
</Button>
</HStack>
)
}
type ModalButtonBarProps = {
acceptButtonLabel?: string
onOpenChange: (open: boolean) => void
}
export const ModalButtonBar = (props: ModalButtonBarProps) => {
return (
<HStack
alignment="center"
distribution="end"
css={{
gap: '10px',
width: '100%',
height: '80px',
}}
>
<Button style={'ctaOutlineYellow'} type="button" onClick={(event) => {
console.log('cancelinmg')
event.preventDefault()
props.onOpenChange(false)
}}
>
{'Cancel'}
</Button>
<Button style={'ctaDarkYellow'}>
{props.acceptButtonLabel || 'Submit'}
</Button>
</HStack>
)
}

View File

@ -1,7 +1,9 @@
import { import {
ModalButtonBar,
ModalContent, ModalContent,
ModalOverlay, ModalOverlay,
ModalRoot, ModalRoot,
ModalTitleBar,
} from '../elements/ModalPrimitives' } from '../elements/ModalPrimitives'
import { Box, HStack, VStack } from '../elements/LayoutPrimitives' import { Box, HStack, VStack } from '../elements/LayoutPrimitives'
import { Button } from '../elements/Button' import { Button } from '../elements/Button'
@ -33,28 +35,7 @@ export function FormModal(props: FormModalProps): JSX.Element {
css={{ overflow: 'auto', px: '24px' }} css={{ overflow: 'auto', px: '24px' }}
> >
<VStack> <VStack>
<HStack <ModalTitleBar title={props.title} onOpenChange={props.onOpenChange} />
distribution="between"
alignment="center"
css={{ height: '68px', width: '100%' }}
>
<StyledText style="modalHeadline" css={{ }}>
{props.title}
</StyledText>
<Button
css={{ ml: 'auto' }}
style="ghost"
onClick={() => {
props.onOpenChange(false)
}}
>
<X
size={24}
color={theme.colors.textNonessential.toString()}
/>
</Button>
</HStack>
<Box css={{ width: '100%' }}> <Box css={{ width: '100%' }}>
<form <form
onSubmit={(event) => { onSubmit={(event) => {
@ -66,34 +47,14 @@ export function FormModal(props: FormModalProps): JSX.Element {
{inputs.map((input, index) => ( {inputs.map((input, index) => (
<VStack key={index}> <VStack key={index}>
<StyledText style={'menuTitle'} css={{ pt: index > 0 ? '10px' : 'unset' }}> <StyledText style={'menuTitle'} css={{ pt: index > 0 ? '10px' : 'unset' }}>
{input.label} {input.label}
</StyledText> </StyledText>
<Box css={{ width: '100%' }}> <Box css={{ width: '100%' }}>
<GeneralFormInput {...input} /> <GeneralFormInput {...input} />
</Box> </Box>
</VStack> </VStack>
))} ))}
<HStack <ModalButtonBar onOpenChange={props.onOpenChange} acceptButtonLabel={props.acceptButtonLabel} />
alignment="center"
distribution="end"
css={{
gap: '10px',
width: '100%',
height: '80px',
}}
>
<Button style={'ctaOutlineYellow'} type="button" onClick={(event) => {
console.log('cancelinmg')
event.preventDefault()
props.onOpenChange(false)
}}
>
{'Cancel'}
</Button>
<Button style={'ctaDarkYellow'}>
{props.acceptButtonLabel || 'Submit'}
</Button>
</HStack>
</form> </form>
</Box> </Box>
</VStack> </VStack>

View File

@ -2,6 +2,8 @@ import {
ModalRoot, ModalRoot,
ModalContent, ModalContent,
ModalOverlay, ModalOverlay,
ModalTitleBar,
ModalButtonBar,
} from './../../elements/ModalPrimitives' } from './../../elements/ModalPrimitives'
import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives' import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
import { Button } from '../../elements/Button' import { Button } from '../../elements/Button'
@ -75,41 +77,22 @@ export function HighlightNoteModal(
<ModalRoot defaultOpen onOpenChange={props.onOpenChange}> <ModalRoot defaultOpen onOpenChange={props.onOpenChange}>
<ModalOverlay /> <ModalOverlay />
<ModalContent <ModalContent
css={{ overflow: 'auto' }} css={{ bg: '$grayBg', px: '24px' }}
onPointerDownOutside={(event) => { onPointerDownOutside={(event) => {
event.preventDefault() event.preventDefault()
}} }}
> >
<VStack> <VStack>
<HStack <ModalTitleBar title="Notes" onOpenChange={props.onOpenChange} />
distribution="between"
alignment="center"
css={{ width: '100%' }}
>
<StyledText style="modalHeadline" css={{ p: '16px' }}>
Notes
</StyledText>
<Button
css={{ pt: '16px', pr: '16px' }}
style="ghost"
onClick={() => {
props.onOpenChange(false)
}}
>
<CrossIcon
size={20}
strokeColor={theme.colors.grayText.toString()}
/>
</Button>
</HStack>
<SpanBox css={{ width: '100%', height: '1px', opacity: '0.2', backgroundColor: theme.colors.grayText.toString() }} />
<StyledTextArea <StyledTextArea
css={{ css={{
mt: '$2', mt: '16px',
width: '95%', p: '6px',
p: '0px', width: '100%',
height: '$6', height: '248px',
marginLeft: '16px', fontSize: '14px',
border: '1px solid $textNonessential',
borderRadius: '6px'
}} }}
autoFocus autoFocus
placeholder={'Add your note here'} placeholder={'Add your note here'}
@ -117,19 +100,7 @@ export function HighlightNoteModal(
onChange={handleNoteContentChange} onChange={handleNoteContentChange}
maxLength={4000} maxLength={4000}
/> />
<SpanBox css={{ width: '100%', height: '1px', opacity: '0.2', backgroundColor: theme.colors.grayText.toString() }} /> <ModalButtonBar onOpenChange={props.onOpenChange} acceptButtonLabel="Save" />
<HStack
alignment="end"
distribution="end"
css={{
width: '100%',
padding: '22px 22px 20px 0',
}}
>
<Button style={'ctaDarkYellow'} onClick={saveNoteChanges}>
Save
</Button>
</HStack>
</VStack> </VStack>
</ModalContent> </ModalContent>
</ModalRoot> </ModalRoot>

View File

@ -2,6 +2,8 @@ import {
ModalRoot, ModalRoot,
ModalContent, ModalContent,
ModalOverlay, ModalOverlay,
ModalTitleBar,
ModalButtonBar,
} from '../../elements/ModalPrimitives' } from '../../elements/ModalPrimitives'
import { VStack, HStack, Box, SpanBox } from '../../elements/LayoutPrimitives' import { VStack, HStack, Box, SpanBox } from '../../elements/LayoutPrimitives'
import { Button } from '../../elements/Button' import { Button } from '../../elements/Button'
@ -63,33 +65,15 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element {
<ModalRoot defaultOpen onOpenChange={props.onOpenChange}> <ModalRoot defaultOpen onOpenChange={props.onOpenChange}>
<ModalOverlay /> <ModalOverlay />
<ModalContent <ModalContent
css={{ bg: '$grayBg', height: '218px' }} css={{ bg: '$grayBg', px: '24px' }}
onInteractOutside={() => { onInteractOutside={() => {
// remove focus from modal // remove focus from modal
;(document.activeElement as HTMLElement).blur() ;(document.activeElement as HTMLElement).blur()
}} }}
> >
<VStack distribution="start"> <VStack distribution="start">
<HStack <ModalTitleBar title="Add Link" onOpenChange={props.onOpenChange} />
distribution="between" <Box css={{ width: '100%', py: '16px' }}>
alignment="center"
css={{ width: '100%', mt: '4px', px: '16px', py: '16px' }}
>
<StyledText style="modalHeadline">Add a Link</StyledText>
<Button
css={{ cursor: 'pointer', }}
style="ghost"
onClick={() => {
props.onOpenChange(false)
}}
>
<CrossIcon
size={11}
strokeColor={theme.colors.grayTextContrast.toString()}
/>
</Button>
</HStack>
<Box css={{ width: '100%', px: '16px', pt: '42px', pb: '24px' }}>
<form <form
onSubmit={(event) => { onSubmit={(event) => {
event.preventDefault() event.preventDefault()
@ -118,16 +102,15 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element {
onChange={(event) => setLink(event.target.value)} onChange={(event) => setLink(event.target.value)}
css={{ css={{
borderRadius: '8px', borderRadius: '8px',
border: '1px solid $grayTextContrast', border: '1px solid $textNonessential',
width: '100%', width: '100%',
height: '38px',
p: '6px', p: '6px',
mb: '13px',
fontSize: '14px',
}} }}
/> />
<HStack distribution="end" css={{ mt: '16px', width: '100%' }}> <ModalButtonBar onOpenChange={props.onOpenChange} acceptButtonLabel="Add Link" />
<Button style="ctaDarkYellow" css={{ mb: '0px' }}>
Add Link
</Button>
</HStack>
</form> </form>
</Box> </Box>
</VStack> </VStack>

View File

@ -49,7 +49,6 @@ export function useGetApiKeysQuery(): ApiKeysQueryResponse {
` `
const { data, mutate, error, isValidating } = useSWR(query, publicGqlFetcher) const { data, mutate, error, isValidating } = useSWR(query, publicGqlFetcher)
console.log('api keys data', data)
try { try {
if (data) { if (data) {