Skip to content

Commit cafe194

Browse files
feat: redesign share page (but it is a hack for now)
1 parent 5549b08 commit cafe194

File tree

14 files changed

+192
-180
lines changed

14 files changed

+192
-180
lines changed

src/components/AssetPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Box, Grid } from '@material-ui/core'
2+
23
import { Typography } from './swarm-ui'
34
import type { ReactElement, CSSProperties } from 'react'
45
import { File, Folder, Monitor } from 'react-feather'

src/components/Tabs.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/components/swarm-ui/Button.tsx

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createUseStyles } from 'react-jss'
2-
import { ReactElement, ReactNode, CSSProperties, ElementType } from 'react'
2+
import type { ReactElement, ReactNode, CSSProperties, ElementType, MouseEventHandler } from 'react'
33

44
import Typography from './Typography'
55
import { colors } from './css'
@@ -31,6 +31,28 @@ const useStyles = createUseStyles({
3131
transition: '0.1s',
3232
},
3333
},
34+
'& > *:not(:last-child)': {
35+
marginRight: 10,
36+
display: 'flex',
37+
justifyContent: 'center',
38+
alignItems: 'center',
39+
},
40+
},
41+
light: {
42+
color: colors.text.normal,
43+
backgroundColor: colors.white,
44+
padding: 8,
45+
cursor: 'pointer',
46+
'& svg': {
47+
fill: colors.text.normal,
48+
},
49+
'&:hover, &:active': {
50+
backgroundColor: colors.lightOrange,
51+
color: colors.swarmOrange,
52+
'& svg': {
53+
fill: colors.swarmOrange,
54+
},
55+
},
3456
},
3557
disabled: {
3658
color: colors.text.normal,
@@ -42,27 +64,19 @@ const useStyles = createUseStyles({
4264
'&:hover, &:active': {
4365
color: colors.text.normal,
4466
backgroundColor: colors.surface.lightGray,
45-
transition: '0.1s',
4667
'& svg': {
4768
fill: colors.text.normal,
48-
transition: '0.1s',
4969
},
5070
},
5171
},
52-
icon: {
53-
marginRight: 10,
54-
display: 'flex',
55-
justifyContent: 'center',
56-
alignItems: 'center',
57-
},
5872
})
5973

6074
interface Props {
61-
variant: 'primary' | 'secondary'
62-
children: ReactNode
75+
variant: 'primary' | 'secondary' | 'light'
76+
children?: ReactNode
6377
icon?: ReactElement
6478
style?: CSSProperties
65-
onClick?: () => void
79+
onClick?: MouseEventHandler
6680
className?: string
6781
component?: ElementType
6882
disabled?: boolean
@@ -73,15 +87,19 @@ const Button = ({ variant, children, style, onClick, icon, className, component,
7387

7488
const DefaultComponent: ElementType = component || 'div'
7589

90+
let variantClass = ''
91+
92+
if (variant === 'light') variantClass = classes.light
93+
7694
return (
77-
<Typography variant="button" style={style} className={className}>
95+
<Typography variant={variant === 'light' ? 'code' : 'button'} style={style} className={className}>
7896
<DefaultComponent
79-
className={`${classes.common} ${disabled ? classes.disabled : ''}`}
97+
className={`${classes.common} ${variantClass} ${disabled ? classes.disabled : ''}`}
8098
onClick={disabled ? undefined : onClick}
8199
disabled={disabled}
82100
>
83-
{icon ? <div className={classes.icon}>{icon}</div> : null}
84-
{children}
101+
{icon}
102+
{children ? <span>{children}</span> : null}
85103
</DefaultComponent>
86104
</Typography>
87105
)

src/components/swarm-ui/IconButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createUseStyles } from 'react-jss'
2-
import { ReactElement, CSSProperties, ElementType } from 'react'
2+
import type { ReactElement, CSSProperties, ElementType, MouseEventHandler } from 'react'
33

44
import { colors } from './css'
55

@@ -44,7 +44,7 @@ const useStyles = createUseStyles({
4444
interface Props {
4545
icon?: ReactElement
4646
style?: CSSProperties
47-
onClick?: () => void
47+
onClick?: MouseEventHandler
4848
className?: string
4949
component?: ElementType
5050
}

src/components/swarm-ui/css.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const colors = {
22
swarmOrange: '#dd7200',
3+
lightOrange: '#fcf2e8',
34
white: 'white',
45
text: {
56
normal: '#303030',
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { IconProps, DEFAULT_SIZE } from './index'
2+
3+
export default function ClipboardLine({ size, ...rest }: IconProps) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
viewBox="0 0 24 24"
8+
width={size || DEFAULT_SIZE}
9+
height={size || DEFAULT_SIZE}
10+
{...rest}
11+
>
12+
<path fill="none" d="M0 0h24v24H0z" />
13+
<path d="M7 4V2h10v2h3.007c.548 0 .993.445.993.993v16.014a.994.994 0 0 1-.993.993H3.993A.994.994 0 0 1 3 21.007V4.993C3 4.445 3.445 4 3.993 4H7zm0 2H5v14h14V6h-2v2H7V6zm2-2v2h6V4H9z" />
14+
</svg>
15+
)
16+
}
17+
18+
ClipboardLine.displayName = 'ClipboardLine'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { IconProps, DEFAULT_SIZE } from './index'
2+
3+
export default function EyeLine({ size, ...rest }: IconProps) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
viewBox="0 0 24 24"
8+
width={size || DEFAULT_SIZE}
9+
height={size || DEFAULT_SIZE}
10+
{...rest}
11+
>
12+
<path fill="none" d="M0 0h24v24H0z" />
13+
<path d="M12 3c5.392 0 9.878 3.88 10.819 9-.94 5.12-5.427 9-10.819 9-5.392 0-9.878-3.88-10.819-9C2.121 6.88 6.608 3 12 3zm0 16a9.005 9.005 0 0 0 8.777-7 9.005 9.005 0 0 0-17.554 0A9.005 9.005 0 0 0 12 19zm0-2.5a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9zm0-2a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z" />
14+
</svg>
15+
)
16+
}
17+
18+
EyeLine.displayName = 'EyeLine'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { IconProps, DEFAULT_SIZE } from './index'
2+
3+
export default function EyeOffLine({ size, ...rest }: IconProps) {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
viewBox="0 0 24 24"
8+
width={size || DEFAULT_SIZE}
9+
height={size || DEFAULT_SIZE}
10+
{...rest}
11+
>
12+
<path fill="none" d="M0 0h24v24H0z" />
13+
<path d="M17.882 19.297A10.949 10.949 0 0 1 12 21c-5.392 0-9.878-3.88-10.819-9a10.982 10.982 0 0 1 3.34-6.066L1.392 2.808l1.415-1.415 19.799 19.8-1.415 1.414-3.31-3.31zM5.935 7.35A8.965 8.965 0 0 0 3.223 12a9.005 9.005 0 0 0 13.201 5.838l-2.028-2.028A4.5 4.5 0 0 1 8.19 9.604L5.935 7.35zm6.979 6.978l-3.242-3.242a2.5 2.5 0 0 0 3.241 3.241zm7.893 2.264l-1.431-1.43A8.935 8.935 0 0 0 20.777 12 9.005 9.005 0 0 0 9.552 5.338L7.974 3.76C9.221 3.27 10.58 3 12 3c5.392 0 9.878 3.88 10.819 9a10.947 10.947 0 0 1-2.012 4.592zm-9.084-9.084a4.5 4.5 0 0 1 4.769 4.769l-4.77-4.769z" />
14+
</svg>
15+
)
16+
}
17+
18+
EyeOffLine.displayName = 'EyeOffLine'

src/components/swarm-ui/icons/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,25 @@ import FolderAddLine from './FolderAddLine'
66
import DownloadLine from './DownloadLine'
77
import UploadLine from './UploadLine'
88
import DragDropLine from './DragDropLine'
9+
import EyeLine from './EyeLine'
10+
import EyeOffLine from './EyeOffLine'
11+
import ClipboardLine from './ClipboardLine'
912

1013
export interface IconProps extends SVGAttributes<SVGElement> {
1114
size?: string | number
1215
}
1316

1417
export const DEFAULT_SIZE = 18
1518

16-
export { ArrowLeftLine, CheckFill, DragDropLine, DownloadLine, UploadLine, FileAddLine, FolderAddLine }
19+
export {
20+
ArrowLeftLine,
21+
CheckFill,
22+
DragDropLine,
23+
DownloadLine,
24+
UploadLine,
25+
FileAddLine,
26+
FolderAddLine,
27+
EyeLine,
28+
EyeOffLine,
29+
ClipboardLine,
30+
}

src/components/swarm-ui/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import IconButton from './IconButton'
33
import Link from './Link'
44
import Tooltip from './Tooltip'
55
import Typography from './Typography'
6+
import { colors } from './css'
67

7-
export { Button, IconButton, Link, Tooltip, Typography }
8+
export { Button, IconButton, Link, Tooltip, Typography, colors }

0 commit comments

Comments
 (0)