feat: add title field to shortcut

This commit is contained in:
Steven
2023-07-31 21:53:06 +08:00
parent 714889433f
commit e6ece43231
7 changed files with 45 additions and 4 deletions

View File

@ -27,6 +27,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
shortcutCreate: {
name: "",
link: "",
title: "",
description: "",
visibility: "PRIVATE",
tags: [],
@ -85,6 +86,14 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
});
};
const handleTitleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setPartialState({
shortcutCreate: Object.assign(state.shortcutCreate, {
title: e.target.value,
}),
});
};
const handleVisibilityInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setPartialState({
shortcutCreate: Object.assign(state.shortcutCreate, {
@ -184,6 +193,18 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
</Button>
</div>
<div className="overflow-y-auto overflow-x-hidden">
<div className="w-full flex flex-col justify-start items-start mb-3">
<span className="mb-2">Title</span>
<div className="relative w-full">
<Input
className="w-full"
type="text"
placeholder="Title"
value={state.shortcutCreate.title}
onChange={handleTitleInputChange}
/>
</div>
</div>
<div className="w-full flex flex-col justify-start items-start mb-3">
<span className="mb-2">Name</span>
<div className="relative w-full">

View File

@ -19,6 +19,7 @@ interface Shortcut {
name: string;
link: string;
title: string;
description: string;
visibility: Visibility;
tags: string[];
@ -29,6 +30,7 @@ interface Shortcut {
interface ShortcutCreate {
name: string;
link: string;
title: string;
description: string;
visibility: Visibility;
tags: string[];
@ -40,6 +42,7 @@ interface ShortcutPatch {
name?: string;
link?: string;
title?: string;
description?: string;
visibility?: Visibility;
tags?: string[];