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])
|
||||
|
||||
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 (
|
||||
<div style={{ paddingBottom: 150 }}>
|
||||
<Title title={title} onChange={onChangeTitle} />
|
||||
|
@ -178,23 +200,19 @@ const Post = () => {
|
|||
id: generateUUID()
|
||||
}])
|
||||
}}
|
||||
style={{ flex: .7, lineHeight: '40px' }}
|
||||
type="default"
|
||||
>
|
||||
Add a File
|
||||
</Button>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
gap: 'var(--gap)',
|
||||
alignItems: 'center',
|
||||
}}>
|
||||
<div className={styles.rightButtons}>
|
||||
{<DatePicker
|
||||
onChange={onChangeExpiration}
|
||||
customInput={<Input label="Expires at" clearable height="40px" />}
|
||||
customInput={<Input label="Expires at" clearable width="100%" height="40px" />}
|
||||
placeholderText="Won't expire"
|
||||
selected={expiresAt}
|
||||
showTimeInput={true}
|
||||
// customTimeInput={<Input htmlType="time" />}
|
||||
// @ts-ignore
|
||||
customTimeInput={<CustomTimeInput />}
|
||||
timeInputLabel="Time:"
|
||||
dateFormat="MM/dd/yyyy h:mm aa"
|
||||
className={styles.datePicker}
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin-top: var(--gap-double);
|
||||
gap: var(--gap);
|
||||
}
|
||||
|
||||
.buttons .rightButtons {
|
||||
display: flex;
|
||||
gap: var(--gap);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.datePicker {
|
||||
|
@ -30,4 +37,13 @@
|
|||
justify-content: space-between;
|
||||
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}>
|
||||
<Card style={{ overflowY: 'scroll' }}>
|
||||
<Card.Body>
|
||||
<Text h3>
|
||||
<Text h3 style={{
|
||||
}}>
|
||||
<NextLink passHref={true} href={getPostPath(post.visibility, post.id)}>
|
||||
<Link color marginRight={'var(--gap)'}>
|
||||
{post.title}
|
||||
</Link>
|
||||
</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' }}>
|
||||
<Button iconRight={<Trash />} onClick={deletePost} auto />
|
||||
</span>}
|
||||
</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>
|
||||
<Divider h="1px" my={0} />
|
||||
<Card.Content>
|
||||
|
|
Loading…
Reference in a new issue