client: mobile post page adjustments with longer button bar

This commit is contained in:
Max Leiter 2022-04-03 13:09:04 -07:00
parent f6cd545ca7
commit f8ba5b32c9
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A3512F2F2F17EBDA
6 changed files with 23 additions and 21 deletions

View file

@ -1,7 +1,7 @@
.tabs { .tabs {
justify-content: center; justify-content: center;
display: flex; display: flex;
margin-top: var(--gap); margin: var(--gap) 0;
} }
.tabs .buttons { .tabs .buttons {
@ -22,7 +22,7 @@
} }
.mobile { .mobile {
position: relative; position: absolute;
z-index: 1; z-index: 1;
} }

View file

@ -174,7 +174,7 @@ const Header = () => {
const buttons = useMemo(() => pages.map(getButton), [pages, getButton]) const buttons = useMemo(() => pages.map(getButton), [pages, getButton])
return ( return (
<Page.Header height={'var(--page-nav-height)'} marginBottom={2}> <Page.Header>
<div className={styles.tabs}> <div className={styles.tabs}>
<div className={styles.buttons}> <div className={styles.buttons}>
{buttons} {buttons}
@ -192,7 +192,8 @@ const Header = () => {
<MenuIcon /> <MenuIcon />
</Button> </Button>
</div> </div>
{isMobile && expanded && (<div className={styles.mobile}> {/* setExpanded should occur elsewhere; we don't want to close if they change themes */}
{isMobile && expanded && (<div className={styles.mobile} onClick={() => setExpanded(!expanded)}>
<ButtonGroup vertical style={{ <ButtonGroup vertical style={{
background: "var(--bg)", background: "var(--bg)",
}}> }}>

View file

@ -89,20 +89,8 @@ const PostPage = ({ post }: Props) => {
<Page.Content className={homeStyles.main}> <Page.Content className={homeStyles.main}>
<div className={styles.header}> <div className={styles.header}>
<span className={styles.title}>
<Text h3>{post.title}</Text>
<span className={styles.badges}>
<VisibilityBadge visibility={post.visibility} />
<CreatedAgoBadge createdAt={post.createdAt} />
<ExpirationBadge postExpirationDate={post.expiresAt} />
</span>
</span>
<span className={styles.buttons}> <span className={styles.buttons}>
<ButtonGroup vertical={isMobile}> <ButtonGroup vertical={isMobile} marginLeft={0} marginRight={0} marginTop={1} marginBottom={1}>
<Button auto onClick={download} icon={<Archive />} style={{ textTransform: 'none' }}>
Download as ZIP Archive
</Button>
<Button <Button
auto auto
icon={<Edit />} icon={<Edit />}
@ -117,9 +105,22 @@ const PostPage = ({ post }: Props) => {
> >
View Parent View Parent
</Button>} </Button>}
<Button auto onClick={download} icon={<Archive />} style={{ textTransform: 'none' }}>
Download as ZIP Archive
</Button>
<FileDropdown isMobile={isMobile} files={post.files || []} /> <FileDropdown isMobile={isMobile} files={post.files || []} />
</ButtonGroup> </ButtonGroup>
</span> </span>
<span className={styles.title}>
<Text h3>{post.title}</Text>
<span className={styles.badges}>
<VisibilityBadge visibility={post.visibility} />
<CreatedAgoBadge createdAt={post.createdAt} />
<ExpirationBadge postExpirationDate={post.expiresAt} />
</span>
</span>
</div> </div>
{/* {post.files.length > 1 && <FileTree files={post.files} />} */} {/* {post.files.length > 1 && <FileTree files={post.files} />} */}
{post.files?.map(({ id, content, title }: File) => ( {post.files?.map(({ id, content, title }: File) => (

View file

@ -3,7 +3,6 @@
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: var(--gap);
} }
.header .title .badges { .header .title .badges {
@ -20,6 +19,7 @@
.header .buttons { .header .buttons {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-bottom: var(--gap);
} }
@media screen and (max-width: 900px) { @media screen and (max-width: 900px) {

View file

@ -15,10 +15,11 @@ const ScrollToTop = () => {
}, []) }, [])
const isReducedMotion = typeof window !== 'undefined' ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : false const isReducedMotion = typeof window !== 'undefined' ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : false
const onClick = (e: React.MouseEvent<HTMLButtonElement>) => { const onClick = async (e: React.MouseEvent<HTMLButtonElement>) => {
// blur the button
e.currentTarget.blur() e.currentTarget.blur()
window.scrollTo({ top: 0, behavior: isReducedMotion ? 'auto' : 'smooth' }) window.scrollTo({ top: 0, behavior: isReducedMotion ? 'auto' : 'smooth' })
} }
return ( return (

View file

@ -29,7 +29,6 @@
--transition: 0.1s ease-in-out; --transition: 0.1s ease-in-out;
--transition-slow: 0.3s ease-in-out; --transition-slow: 0.3s ease-in-out;
--page-nav-height: 64px;
--token: #999; --token: #999;
--comment: #999; --comment: #999;
--keyword: #fff; --keyword: #fff;