index.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { useVideosQuery, Video } from '../../../src/gql'
  2. import { FunctionComponent } from 'react'
  3. import { AdminList } from '../../../src/app'
  4. import theme from '../../../src/styles/theme'
  5. import FileSelector from '../../../src/file/components/FileSelector'
  6. const AdminVideo: FunctionComponent<{ item: Partial<Video>; className?: string }> = ({
  7. item,
  8. className,
  9. }) => {
  10. return (
  11. <div className={className}>
  12. <div className='admin-video-title'>{item.title}</div>
  13. <div className='admin-video-description'>{item.description}</div>
  14. <div className='admin-video-file'>{item.file?.filename}</div>
  15. <style jsx>{`
  16. .${className} {
  17. display: flex;
  18. }
  19. .admin-video-title {
  20. width: 15%;
  21. }
  22. .admin-video-description {
  23. width: 65%;
  24. }
  25. .admin-video-file {
  26. width: 20%;
  27. text-align: right;
  28. }
  29. button {
  30. margin: 0 0.4em;
  31. padding: 0;
  32. color: ${theme.colors.buttonBackground};
  33. background-color: transparent;
  34. }
  35. button.false {
  36. color: #5557;
  37. }
  38. `}</style>
  39. </div>
  40. )
  41. }
  42. const AdminVideos = () => {
  43. const props = {
  44. name: 'Videos',
  45. adminMenu: '/admin/video',
  46. get: useVideosQuery(),
  47. dataKey: 'videos',
  48. Component: AdminVideo,
  49. }
  50. return <AdminList {...props} />
  51. }
  52. export default AdminVideos