-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: onboarding etc done, delete up next
- Loading branch information
Showing
13 changed files
with
205 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {PlugIcon} from '@sanity/icons' | ||
import {Button, Card, Flex, Grid, Heading, Inline} from '@sanity/ui' | ||
import React, {useCallback} from 'react' | ||
|
||
import type {SetDialogState} from '../hooks/useDialogState' | ||
import MuxLogo from './MuxLogo' | ||
|
||
interface OnboardProps { | ||
setDialogState: SetDialogState | ||
} | ||
|
||
export default function Onboard(props: OnboardProps) { | ||
const {setDialogState} = props | ||
const handleOpen = useCallback(() => setDialogState('secrets'), [setDialogState]) | ||
|
||
return ( | ||
<> | ||
<div style={{padding: 2}}> | ||
<Card | ||
display="flex" | ||
sizing="border" | ||
style={{aspectRatio: '16/9', width: '100%', boxShadow: 'var(--card-bg-color) 0 0 0 2px'}} | ||
paddingX={[2, 3, 4, 4]} | ||
radius={1} | ||
tone="transparent" | ||
> | ||
<Flex justify="flex-start" align="center"> | ||
<Grid columns={1} gap={[2, 3, 4, 4]}> | ||
<Inline paddingY={1}> | ||
<div style={{height: '32px'}}> | ||
<MuxLogo /> | ||
</div> | ||
</Inline> | ||
<Inline paddingY={1}> | ||
<Heading size={[0, 1, 2, 2]}> | ||
Upload and preview videos directly from your studio. | ||
</Heading> | ||
</Inline> | ||
<Inline paddingY={1}> | ||
<Button mode="ghost" icon={PlugIcon} text="Configure API" onClick={handleOpen} /> | ||
</Inline> | ||
</Grid> | ||
</Flex> | ||
</Card> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import {PlugIcon, SearchIcon, UploadIcon} from '@sanity/icons' | ||
import {DocumentVideoIcon} from '@sanity/icons' | ||
import {Box, Button, Card, Flex, Inline, Text} from '@sanity/ui' | ||
import React, {useCallback} from 'react' | ||
import styled from 'styled-components' | ||
|
||
import type {SetDialogState} from '../hooks/useDialogState' | ||
import {type FileInputButtonProps, FileInputButton} from './FileInputButton' | ||
|
||
const UploadCard = styled(Card)` | ||
&& { | ||
border-style: dashed; | ||
} | ||
` | ||
|
||
const ConfigureApiBox = styled(Box)` | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
` | ||
|
||
interface UploadPlaceholderProps { | ||
setDialogState: SetDialogState | ||
readOnly: boolean | ||
hovering: boolean | ||
needsSetup: boolean | ||
onSelect: FileInputButtonProps['onSelect'] | ||
} | ||
export default function UploadPlaceholder(props: UploadPlaceholderProps) { | ||
const {setDialogState, readOnly, onSelect, hovering, needsSetup} = props | ||
const handleBrowse = useCallback(() => setDialogState('select-video'), [setDialogState]) | ||
const handleConfigureApi = useCallback(() => setDialogState('secrets'), [setDialogState]) | ||
|
||
return ( | ||
<Box style={{padding: 1, position: 'relative'}} height="stretch"> | ||
<UploadCard | ||
sizing="border" | ||
height="fill" | ||
tone={readOnly ? 'transparent' : 'inherit'} | ||
border | ||
padding={3} | ||
style={hovering ? {borderColor: 'transparent'} : undefined} | ||
> | ||
<ConfigureApiBox padding={3}> | ||
<Button | ||
padding={3} | ||
radius={3} | ||
tone={needsSetup ? 'critical' : undefined} | ||
onClick={handleConfigureApi} | ||
icon={PlugIcon} | ||
mode="bleed" | ||
/> | ||
</ConfigureApiBox> | ||
<Flex | ||
align="center" | ||
justify="space-between" | ||
gap={4} | ||
direction={['column', 'column', 'row']} | ||
paddingY={[2, 2, 0]} | ||
sizing="border" | ||
height="fill" | ||
> | ||
<Flex align="center" justify="center" gap={2} flex={1}> | ||
<Flex justify="center"> | ||
<Text muted> | ||
<DocumentVideoIcon /> | ||
</Text> | ||
</Flex> | ||
<Flex justify="center"> | ||
<Text size={1} muted> | ||
Drag video or paste URL here | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
<Inline space={2}> | ||
<FileInputButton | ||
mode="ghost" | ||
tone="default" | ||
icon={UploadIcon} | ||
text="Upload" | ||
onSelect={onSelect} | ||
/> | ||
<Button mode="ghost" icon={SearchIcon} text="Select" onClick={handleBrowse} /> | ||
</Inline> | ||
</Flex> | ||
</UploadCard> | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.