-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/frontend/component/src/components/pdf-viewer/index.tsx
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
33 changes: 33 additions & 0 deletions
33
packages/frontend/component/src/components/pdf-viewer/styles.css.ts
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,33 @@ | ||
import { cssVarV2 } from '@toeverything/theme/v2'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const titlebar = style({ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
width: '100%', | ||
height: '52px', | ||
padding: '10px 0 10px 8px', | ||
background: cssVarV2('layer/background/primary'), | ||
fontSize: '12px', | ||
fontWeight: 400, | ||
color: cssVarV2('text/secondary'), | ||
borderTopWidth: '0.5px', | ||
borderTopStyle: 'solid', | ||
borderTopColor: cssVarV2('layer/insideBorder/border'), | ||
}); | ||
|
||
export const titlebarChild = style({ | ||
selectors: { | ||
[`${titlebar} > &`]: { | ||
display: 'flex', | ||
gap: '12px', | ||
alignItems: 'center', | ||
paddingLeft: '12px', | ||
paddingRight: '12px', | ||
}, | ||
}, | ||
}); | ||
|
||
export const titlebarName = style({ | ||
display: 'flex', | ||
}); |
75 changes: 75 additions & 0 deletions
75
packages/frontend/component/src/components/pdf-viewer/titlebar.tsx
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,75 @@ | ||
import { | ||
EditIcon, | ||
LocalDataIcon, | ||
MoreHorizontalIcon, | ||
ZoomDownIcon, | ||
ZoomUpIcon, | ||
} from '@blocksuite/icons/rc'; | ||
import { useState } from 'react'; | ||
|
||
import { IconButton } from '../../ui/button'; | ||
import { Menu, MenuItem } from '../../ui/menu'; | ||
import * as styles from './styles.css'; | ||
|
||
export interface TitlebarProps { | ||
id: string; | ||
name: string; | ||
ext: string; | ||
size: number; | ||
zoom: number; | ||
} | ||
|
||
const items = [ | ||
{ | ||
name: 'Rename', | ||
icon: <EditIcon />, | ||
action() {}, | ||
}, | ||
{ | ||
name: 'Download', | ||
icon: <LocalDataIcon />, | ||
action() {}, | ||
}, | ||
]; | ||
|
||
export const MenuItems = () => | ||
items.map(({ name, icon, action }) => ( | ||
<MenuItem key={name} onClick={action} prefixIcon={icon}> | ||
{name} | ||
</MenuItem> | ||
)); | ||
|
||
export const Titlebar = ({ name, ext, size, zoom = 100 }: TitlebarProps) => { | ||
const [openMenu, setOpenMenu] = useState(false); | ||
|
||
return ( | ||
<div className={styles.titlebar}> | ||
<div className={styles.titlebarChild}> | ||
<div className={styles.titlebarName}> | ||
<div>{name}</div> | ||
<span>{ext}</span> | ||
</div> | ||
<div>{size}MB</div> | ||
<IconButton icon={<LocalDataIcon />}></IconButton> | ||
<Menu | ||
items={<MenuItems />} | ||
rootOptions={{ | ||
open: openMenu, | ||
onOpenChange: setOpenMenu, | ||
}} | ||
contentOptions={{ | ||
side: 'bottom', | ||
avoidCollisions: false, | ||
}} | ||
> | ||
<IconButton icon={<MoreHorizontalIcon />}></IconButton> | ||
</Menu> | ||
</div> | ||
<div className={styles.titlebarChild}> | ||
<IconButton icon={<ZoomDownIcon />}></IconButton> | ||
<div>{zoom}%</div> | ||
<IconButton icon={<ZoomUpIcon />}></IconButton> | ||
</div> | ||
</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