51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import type { AdminTitlesQuery, AdminTitlesQueryVariables } from 'types/graphql'
|
|
|
|
import type {
|
|
CellSuccessProps,
|
|
CellFailureProps,
|
|
TypedDocumentNode,
|
|
} from '@redwoodjs/web'
|
|
|
|
import CellFailure from 'src/components/Cell/CellFailure/CellFailure'
|
|
import CellLoading from 'src/components/Cell/CellLoading/CellLoading'
|
|
|
|
import TitlesForm from '../TitlesForm/TitlesForm'
|
|
|
|
export const QUERY: TypedDocumentNode<
|
|
AdminTitlesQuery,
|
|
AdminTitlesQueryVariables
|
|
> = gql`
|
|
query AdminTitlesQuery {
|
|
titles {
|
|
id
|
|
titles
|
|
}
|
|
}
|
|
`
|
|
|
|
export const Loading = () => <CellLoading />
|
|
export const Failure = ({
|
|
error,
|
|
}: CellFailureProps<AdminTitlesQueryVariables>) => <CellFailure error={error} />
|
|
|
|
export const Success = ({ titles }: CellSuccessProps<AdminTitlesQuery>) => (
|
|
<div className="flex w-full justify-center">
|
|
<div className="overflow-hidden overflow-x-auto rounded-xl bg-base-100">
|
|
<table className="table w-80">
|
|
<thead className="bg-base-200 font-syne">
|
|
<tr>
|
|
<th className="w-0">Titles</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th>
|
|
<TitlesForm titles={titles} />
|
|
</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
)
|