client: new-post style improvements and date picker bug fixes
This commit is contained in:
parent
5da96a8f0a
commit
222b020e9a
3 changed files with 60 additions and 23 deletions
|
@ -163,6 +163,28 @@ const Post = () => {
|
||||||
}
|
}
|
||||||
}, [title])
|
}, [title])
|
||||||
|
|
||||||
|
const CustomTimeInput = ({ date, value, onChange }: {
|
||||||
|
date: Date,
|
||||||
|
value: string,
|
||||||
|
onChange: (date: string) => void
|
||||||
|
}) => (
|
||||||
|
<input
|
||||||
|
type="time"
|
||||||
|
value={value}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (!isNaN(date.getTime())) {
|
||||||
|
onChange(e.target.value || date.toISOString().slice(11, 16))
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
backgroundColor: 'var(--bg)',
|
||||||
|
border: '1px solid var(--light-gray)',
|
||||||
|
borderRadius: 'var(--radius)'
|
||||||
|
}}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ paddingBottom: 150 }}>
|
<div style={{ paddingBottom: 150 }}>
|
||||||
<Title title={title} onChange={onChangeTitle} />
|
<Title title={title} onChange={onChangeTitle} />
|
||||||
|
@ -178,23 +200,19 @@ const Post = () => {
|
||||||
id: generateUUID()
|
id: generateUUID()
|
||||||
}])
|
}])
|
||||||
}}
|
}}
|
||||||
style={{ flex: .7, lineHeight: '40px' }}
|
|
||||||
type="default"
|
type="default"
|
||||||
>
|
>
|
||||||
Add a File
|
Add a File
|
||||||
</Button>
|
</Button>
|
||||||
<div style={{
|
<div className={styles.rightButtons}>
|
||||||
display: 'flex',
|
|
||||||
gap: 'var(--gap)',
|
|
||||||
alignItems: 'center',
|
|
||||||
}}>
|
|
||||||
{<DatePicker
|
{<DatePicker
|
||||||
onChange={onChangeExpiration}
|
onChange={onChangeExpiration}
|
||||||
customInput={<Input label="Expires at" clearable height="40px" />}
|
customInput={<Input label="Expires at" clearable width="100%" height="40px" />}
|
||||||
placeholderText="Won't expire"
|
placeholderText="Won't expire"
|
||||||
selected={expiresAt}
|
selected={expiresAt}
|
||||||
showTimeInput={true}
|
showTimeInput={true}
|
||||||
// customTimeInput={<Input htmlType="time" />}
|
// @ts-ignore
|
||||||
|
customTimeInput={<CustomTimeInput />}
|
||||||
timeInputLabel="Time:"
|
timeInputLabel="Time:"
|
||||||
dateFormat="MM/dd/yyyy h:mm aa"
|
dateFormat="MM/dd/yyyy h:mm aa"
|
||||||
className={styles.datePicker}
|
className={styles.datePicker}
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: var(--gap-double);
|
margin-top: var(--gap-double);
|
||||||
|
gap: var(--gap);
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons .rightButtons {
|
||||||
|
display: flex;
|
||||||
|
gap: var(--gap);
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.datePicker {
|
.datePicker {
|
||||||
|
@ -30,4 +37,13 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
min-height: 95px;
|
min-height: 95px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttons .rightButtons {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons .rightButtons > * {
|
||||||
|
width: min(100%, 350px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,31 +18,34 @@ const ListItem = ({ post, isOwner = true, deletePost }: { post: Post, isOwner?:
|
||||||
return (<FadeIn><li key={post.id}>
|
return (<FadeIn><li key={post.id}>
|
||||||
<Card style={{ overflowY: 'scroll' }}>
|
<Card style={{ overflowY: 'scroll' }}>
|
||||||
<Card.Body>
|
<Card.Body>
|
||||||
<Text h3>
|
<Text h3 style={{
|
||||||
|
}}>
|
||||||
<NextLink passHref={true} href={getPostPath(post.visibility, post.id)}>
|
<NextLink passHref={true} href={getPostPath(post.visibility, post.id)}>
|
||||||
<Link color marginRight={'var(--gap)'}>
|
<Link color marginRight={'var(--gap)'}>
|
||||||
{post.title}
|
{post.title}
|
||||||
</Link>
|
</Link>
|
||||||
</NextLink>
|
</NextLink>
|
||||||
<div style={{ display: 'inline-flex' }}>
|
|
||||||
<span>
|
|
||||||
<VisibilityBadge visibility={post.visibility} />
|
|
||||||
</span>
|
|
||||||
<span style={{ marginLeft: 'var(--gap)' }}>
|
|
||||||
<CreatedAgoBadge createdAt={post.createdAt} />
|
|
||||||
</span>
|
|
||||||
<span style={{ marginLeft: 'var(--gap)' }}>
|
|
||||||
<Badge type="secondary">{post.files.length === 1 ? "1 file" : `${post.files.length} files`}</Badge>
|
|
||||||
</span>
|
|
||||||
<span style={{ marginLeft: 'var(--gap)' }}>
|
|
||||||
<ExpirationBadge postExpirationDate={post.expiresAt} />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{isOwner && <span style={{ float: 'right' }}>
|
{isOwner && <span style={{ float: 'right' }}>
|
||||||
<Button iconRight={<Trash />} onClick={deletePost} auto />
|
<Button iconRight={<Trash />} onClick={deletePost} auto />
|
||||||
</span>}
|
</span>}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
|
||||||
|
<div style={{ display: 'inline-flex' }}>
|
||||||
|
<span>
|
||||||
|
<VisibilityBadge visibility={post.visibility} />
|
||||||
|
</span>
|
||||||
|
<span style={{ marginLeft: 'var(--gap)' }}>
|
||||||
|
<CreatedAgoBadge createdAt={post.createdAt} />
|
||||||
|
</span>
|
||||||
|
<span style={{ marginLeft: 'var(--gap)' }}>
|
||||||
|
<Badge type="secondary">{post.files.length === 1 ? "1 file" : `${post.files.length} files`}</Badge>
|
||||||
|
</span>
|
||||||
|
<span style={{ marginLeft: 'var(--gap)' }}>
|
||||||
|
<ExpirationBadge postExpirationDate={post.expiresAt} />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
</Card.Body>
|
</Card.Body>
|
||||||
<Divider h="1px" my={0} />
|
<Divider h="1px" my={0} />
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
|
|
Loading…
Reference in a new issue