File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .container {
2+ padding : 1rem ;
3+ }
4+
5+ .list {
6+ list-style : none;
7+ padding : 0 ;
8+ }
9+
10+ .item {
11+ display : flex;
12+ justify-content : space-between;
13+ gap : 1rem ;
14+ margin-bottom : 0.5rem ;
15+ text-overflow : ellipsis;
16+ overflow : hidden;
17+ white-space : nowrap;
18+ }
19+
20+ .link {
21+ text-overflow : ellipsis;
22+ overflow : hidden;
23+ white-space : nowrap;
24+ max-width : 500px ;
25+ font-size : 1.2rem ;
26+ }
27+
28+ .newDocument {
29+ display : block;
30+ margin-bottom : 3rem ;
31+ padding : 0.5rem 1rem ;
32+ background-color : # 007bff ;
33+ color : white;
34+ font-size : 1.6rem ;
35+ }
36+
37+ .delete {
38+ margin-left : auto;
39+ }
Original file line number Diff line number Diff line change @@ -2,21 +2,30 @@ import Link from 'next/link'
22
33import { readDocuments } from '@/db/api/documents'
44import { DocumentDelete } from '@/components'
5+ import classes from './page.module.css'
56
67async function DocumentsPage ( ) {
78 const documents = await readDocuments ( )
89
910 return (
10- < article >
11+ < article className = { classes . container } >
1112 < h1 > Documents</ h1 >
12- < Link href = "/admin/documents/new" > New document</ Link >
13- < ul >
13+ < Link className = { classes . newDocument } href = "/admin/documents/new" >
14+ New document
15+ </ Link >
16+ < ul className = { classes . list } >
1417 { documents . map ( ( document ) => (
15- < li key = { document . id } >
16- < Link href = { `/admin/documents/${ document . id } ` } >
18+ < li key = { document . id } className = { classes . item } >
19+ < Link
20+ href = { `/admin/documents/${ document . id } ` }
21+ className = { classes . link }
22+ >
1723 { document . title }
1824 </ Link >
19- < DocumentDelete documentId = { document . id } />
25+ < DocumentDelete
26+ documentId = { document . id }
27+ className = { classes . delete }
28+ />
2029 </ li >
2130 ) ) }
2231 </ ul >
Original file line number Diff line number Diff line change @@ -5,7 +5,13 @@ import { DELETE_DOCUMENT_BY_ID } from '@/db/queries-qraphql'
55
66import classes from './document.module.css'
77
8- const DocumentDelete = ( { documentId } : { documentId : string } ) => {
8+ const DocumentDelete = ( {
9+ documentId,
10+ className,
11+ } : {
12+ documentId : string
13+ className ?: string
14+ } ) => {
915 const [ deleteDocument ] = useMutation ( DELETE_DOCUMENT_BY_ID )
1016
1117 const handleDelete = async ( ) => {
@@ -23,7 +29,10 @@ const DocumentDelete = ({ documentId }: { documentId: string }) => {
2329 }
2430
2531 return (
26- < button onClick = { handleDelete } className = { classes . deleteButton } >
32+ < button
33+ onClick = { handleDelete }
34+ className = { `${ classes . deleteButton } ${ className } ` }
35+ >
2736 Delete
2837 </ button >
2938 )
Original file line number Diff line number Diff line change 2727 font-size : 16px ;
2828 font-family : sans-serif;
2929 color : # 333 ;
30- background-color : # f5f5f5 ;
30+ background-color : # fefefe ;
3131 outline : none;
3232 transition :
3333 border-color 0.2s ease,
Original file line number Diff line number Diff line change 2727 font-size : 16px ;
2828 font-family : sans-serif;
2929 color : # 333 ;
30- background-color : # f5f5f5 ;
30+ background-color : # fefefe ;
3131 outline : none;
3232 transition :
3333 border-color 0.2s ease,
You can’t perform that action at this time.
0 commit comments