Skip to content

Commit 857a5cb

Browse files
committed
✨ Add input field to workbook form (#2020)
1 parent e1f5da5 commit 857a5cb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/lib/components/WorkBook/WorkBookForm.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
bind:isPublished={$form.isPublished}
8989
bind:isOfficial={$form.isOfficial}
9090
bind:isReplenished={$form.isReplenished}
91+
bind:urlSlug={$form.urlSlug}
9192
bind:workBookType={$form.workBookType}
9293
{isAdmin}
9394
message={$message}

src/lib/components/WorkBooks/WorkBookInputFields.svelte

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import SelectWrapper from '$lib/components/SelectWrapper.svelte';
55
import { WorkBookType } from '$lib/types/workbook';
66
7+
// TODO: WorkBookディレクトリに移動させる
78
interface Props {
89
// FIXME: 引数がとても多いので、コンポーネントに渡す引数を減らす方法を調べて実装。
910
authorId: string;
@@ -13,6 +14,7 @@
1314
isPublished: boolean;
1415
isOfficial: boolean;
1516
isReplenished: boolean;
17+
urlSlug?: string | null;
1618
workBookType: WorkBookType;
1719
isAdmin: boolean;
1820
isEditable?: boolean;
@@ -28,6 +30,7 @@
2830
isPublished = $bindable(),
2931
isOfficial = $bindable(),
3032
isReplenished = $bindable(),
33+
urlSlug = $bindable(undefined),
3134
workBookType = $bindable(),
3235
isAdmin,
3336
isEditable = true,
@@ -144,3 +147,12 @@
144147
/>
145148
</div>
146149
</div>
150+
151+
<!-- 管理者のみ: 問題集のカスタムURL -->
152+
<InputFieldWrapper
153+
labelName="問題集のカスタムURL(30文字以下、半角英小文字・半角数字・ハイフンのみ)"
154+
inputFieldName="urlSlug"
155+
bind:inputValue={urlSlug}
156+
isEditable={isAdmin && isEditable}
157+
message={errors.urlSlug}
158+
/>

0 commit comments

Comments
 (0)