Browse Source

#101 余白追加

pull/117/head
みてるぞ 3 weeks ago
parent
commit
537c94a34b
2 changed files with 8 additions and 3 deletions
  1. +2
    -0
      frontend/src/components/PostEditForm.tsx
  2. +6
    -3
      frontend/src/components/common/DateTimeField.tsx

+ 2
- 0
frontend/src/components/PostEditForm.tsx View File

@@ -62,12 +62,14 @@ export default (({ post, onSave }: Props) => {
<Label>オリジナルの作成日時</Label>
<div className="my-1">
<DateTimeField
className="mr-2"
value={originalCreatedFrom ?? undefined}
onChange={setOriginalCreatedFrom}/>
以降
</div>
<div className="my-1">
<DateTimeField
className="mr-2"
value={originalCreatedBefore ?? undefined}
onChange={setOriginalCreatedBefore}/>
より前


+ 6
- 3
frontend/src/components/common/DateTimeField.tsx View File

@@ -1,5 +1,7 @@
import { useEffect, useState } from 'react'

import { cn } from '@/lib/utils'

import type { FC } from 'react'


@@ -19,10 +21,11 @@ const toDateTimeLocalValue = (d: Date) => {

type Props = {
value?: string
onChange?: (isoUTC: string | null) => void }
onChange?: (isoUTC: string | null) => void
className?: string }


export default (({ value, onChange }: Props) => {
export default (({ value, onChange, className }: Props) => {
const [local, setLocal] = useState ('')

useEffect (() => {
@@ -31,7 +34,7 @@ export default (({ value, onChange }: Props) => {

return (
<input
className="border rounded p-2"
className={cn ('border rounded p-2', className)}
type="datetime-local"
step={1}
value={local}


Loading…
Cancel
Save