Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Documentation tables #71

Merged
merged 22 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@radix-ui/react-form": "^0.0.3",
"@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-switch": "^1.1.0",
"@staticcms/core": "^4.1.2",
"@staticcms/proxy-server": "^4.0.4",
"@types/react": "^18.2.64",
Expand Down
31 changes: 26 additions & 5 deletions public/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,41 @@ collections:
folder: src/content/data
media_folder: files
fields:
- name: cat
label: Category
widget: select
options: [ 'Study Design', 'Questionnaire', 'Changes to Questionnaire', 'Codebook', 'Appendices' ]
- name: title
label: Title
widget: string
- name: description
label: Description
widget: text
- name: version
i18n: duplicate
label: Field Season
condition:
field: cat
value: 'Questionnaire'
required: false
- name: codebookType
label: Codebook Category
condition:
field: cat
value: 'Codebook'
widget: select
options: [ 'MMP Core', 'Community Level Supplementary', 'State Level Supplementary', 'National Level Supplementary', 'MSA Level Supplementary' ]
- name: archivo
i18n: duplicate
required: false
label: Spanish File
widget: file
- name: file
i18n: duplicate
label: File
required: false
label: English File
widget: file
- name: cat
label: Category
widget: select
options: [ 'Study Design', 'Questionnaire', 'Changes to Questionnaire', 'Codebook', 'Appendices' ]

- name: news
label: News
identifier_field: pubDate
Expand Down
102 changes: 0 additions & 102 deletions src/components/DataTable.tsx

This file was deleted.

79 changes: 79 additions & 0 deletions src/components/DocumentationTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from "react"
import Button from "./Button.tsx"

interface DocumentationTableProps {
allFiles: {
data: {
title: string
cat: string
file?: string
archivo?: string
description?: string
version?: string
codebookType?: string
}
}[]
version?: boolean
showHeader?: boolean
}

const DocumentationTable: React.FC<DocumentationTableProps> = ({
allFiles,
version,
showHeader,
}) => {
const files = allFiles.map((file) => {
return { ...file.data }
})
return (
<div className="w-full overflow-x-scroll no-scrollbar">
<table className="table-fixed border-spacing-4 w-full">
<thead className={showHeader ? "" : "collapse"}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great

<tr className="text-xl bg-neutral-100 text-left text-neutral-900">
<th className="w-1/4">File</th>
<th>Description</th>
{version && <th className="w-1/5">Field Season</th>}
</tr>
</thead>

<tbody>
{files.map(({ title, file, description, version, archivo }, i) => {
return (
<tr key={i}>
<td className="flex justify-between gap-2">
<p className="font-bold">{title}</p>
<div className="flex gap-1">
(
{file && (
<a
className="text-secondary-blue-700 hover:text-secondary-blue-500"
target="_blank"
href={file}
>
en
</a>
)}
{file && archivo && <p>/</p>}
{archivo && (
<a
className="text-secondary-blue-700 hover:text-secondary-blue-500"
target="_blank"
href={archivo}
>
es
</a>
)}
)
</div>
</td>
<td>{description}</td>
{version && <td>{version}</td>}
</tr>
)
})}
</tbody>
</table>
</div>
)
}
export default DocumentationTable
5 changes: 4 additions & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ const files = defineCollection({
schema: z.object({
title: z.string(),
description: z.string().optional(),
version: z.string().optional(),
cat: z.string(),
file: z.string(),
codebookType: z.string().optional(),
file: z.string().optional(),
archivo: z.string().optional(),
}),
})

Expand Down
6 changes: 6 additions & 0 deletions src/content/data/appendix-a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix A
description: Community Survey Year Codes
file: src/content/data/files/appendix-a-sample-information-mmp174-.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-b.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix B
description: Place Codes in Mexico and the United States
file: src/content/data/files/appendix-b-places-mmp174-.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-c.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix C
description: State Codes in Mexico and the United States
file: src/content/data/files/appendix-c-states-mmp174-.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix D
description: Occupation Codes (English)
file: src/content/data/files/appendix-d-occupations-mmp174-.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-e.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix E
description: Computation of Total U.S. Experience (English)
file: src/content/data/files/appendix-e-computation-of-us-experience-mmp174-.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-f.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix F
description: Farm Codes in Canada
file: src/content/data/files/appendix-f-canadian-farms-mmp174-.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-g.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix G
description: Community Data Inventory (English)
file: src/content/data/files/comquest1999_eng.pdf
cat: Appendices
---
6 changes: 6 additions & 0 deletions src/content/data/appendix-h.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Appendix H
description: MMP Weights
file: src/content/data/files/mmp-and-lamp-weights-2012.pdf
cat: Appendices
---
9 changes: 9 additions & 0 deletions src/content/data/cnmig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: CNMIG
description: cross-sectional file containing information of the household-head -
or another migrant when the household-head was not a migrant - who has
migration experience to Canada.
file: src/content/data/files/cnmig-codebook-mmp174-.pdf
cat: Codebook
codebookType: MMP Core
---
6 changes: 6 additions & 0 deletions src/content/data/commun-174.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Commun 174
description: DTA file
file: src/content/data/files/commun174.dta
cat: Core
---
1 change: 1 addition & 0 deletions src/content/data/commun.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ description: community-level file that provides information at the time of the
survey and it is complemented with other information using the Mexican Census
file: src/content/data/files/codebook_commun.pdf
cat: Codebook
codebookType: Community Level Supplementary
---
7 changes: 7 additions & 0 deletions src/content/data/environs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: ENVIRONS
description: Variable list and specifications
file: src/content/data/files/environs-codebook-mmp134-.pdf
cat: Codebook
codebookType: State Level Supplementary
---
7 changes: 7 additions & 0 deletions src/content/data/ethnosurvey-i.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Ethnosurvey I
description: Survey applied to communities interviewed from 1987 to 1997, and in 1982
version: 1987 - 1997
archivo: src/content/data/files/mmp-etnoencuesta-versión-1-aplicada-de-1987-a-1997.pdf
cat: Questionnaire
---
8 changes: 8 additions & 0 deletions src/content/data/ethnosurvey-ii.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Ethnosurvey II
description: Survey applied to communities interviewed on 1998 and 1999
version: 1998 - 1999
file: src/content/data/files/mmp-ethnosurvey-version-ii-applied-in-1998-and-1999.pdf
archivo: src/content/data/files/mmp-etnoencuesta-versión-2-aplicada-de-1998-a-1999.pdf
cat: Questionnaire
---
Loading