diff --git a/package-lock.json b/package-lock.json index 8374ab4..722a9d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.51.3", + "react-select": "^5.8.0", "tailwindcss": "^3.4.1", "typescript": "^5.3.3" }, @@ -15098,6 +15099,31 @@ "react-dom": "16.x || 17.x || 18.x" } }, + "node_modules/react-select": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.0.tgz", + "integrity": "sha512-TfjLDo58XrhP6VG5M/Mi56Us0Yt8X7xD6cDybC7yoRMUNm7BGO7qk8J0TLQOua/prb8vUOtsfnXZwfm30HGsAA==", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@floating-ui/dom": "^1.0.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^6.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0", + "use-isomorphic-layout-effect": "^1.1.2" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, + "node_modules/react-select/node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" + }, "node_modules/react-style-singleton": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.1.tgz", @@ -17663,6 +17689,19 @@ "react": ">=16.8.0" } }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", + "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/use-sidecar": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz", diff --git a/package.json b/package.json index 6b3a82c..de1e8a7 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.51.3", + "react-select": "^5.8.0", "tailwindcss": "^3.4.1", "typescript": "^5.3.3" }, diff --git a/public/admin/config.yml b/public/admin/config.yml index 64464a6..abc1ed6 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -4,7 +4,7 @@ backend: name: github repo: brown-ccv/mmp base_url: / -media_folder: public/files +media_folder: public/images media_library: max_file_size: 734003200 i18n: @@ -68,22 +68,44 @@ collections: format: yyyy - name: pubs label: Publications - folder: src/content/pubs + folder: src/content/publications + media_folder: public/pubs create: true - slug: '{{year}}-{{month}}-{{day}}_{{title}}_{{slug}}' + identifier_field: citation + slug: '{{fields.classification}}-{{fields.pubDate}}_{{fields.author}}' fields: - name: classification label: Classification widget: select options: [ 'Book', 'Chapter', 'Article', 'Dissertation' ] + - name: author + label: Author(s) + widget: text + - name: pubDate + i18n: duplicate + label: Publish Date + widget: datetime + date_format: MM.yyyy + time_format: false - name: citation i18n: duplicate label: Citation widget: text + - name: image + required: false + i18n: duplicate + label: Image + widget: image - name: url + required: false i18n: duplicate label: Link to Publication widget: string + - name: pdf + required: false + i18n: duplicate + label: PDF + widget: file - name: data label: Data create: true diff --git "a/public/images/Screenshot 2024-06-26 at 2.50.57\342\200\257PM.png" "b/public/images/Screenshot 2024-06-26 at 2.50.57\342\200\257PM.png" deleted file mode 100644 index 3db8825..0000000 Binary files "a/public/images/Screenshot 2024-06-26 at 2.50.57\342\200\257PM.png" and /dev/null differ diff --git a/public/pubs/2013_arias_durand_paul_taylor.pdf b/public/pubs/2013_arias_durand_paul_taylor.pdf new file mode 100644 index 0000000..32019bc Binary files /dev/null and b/public/pubs/2013_arias_durand_paul_taylor.pdf differ diff --git a/public/pubs/donato_hiskey_durand_massey_2010-salvando-fronteras.pdf b/public/pubs/donato_hiskey_durand_massey_2010-salvando-fronteras.pdf new file mode 100644 index 0000000..942b2b1 Binary files /dev/null and b/public/pubs/donato_hiskey_durand_massey_2010-salvando-fronteras.pdf differ diff --git a/public/pubs/global-migration.jpg b/public/pubs/global-migration.jpg new file mode 100644 index 0000000..35548dd Binary files /dev/null and b/public/pubs/global-migration.jpg differ diff --git a/public/pubs/haciaelotronorte.pdf b/public/pubs/haciaelotronorte.pdf new file mode 100644 index 0000000..61eefd2 Binary files /dev/null and b/public/pubs/haciaelotronorte.pdf differ diff --git a/public/pubs/handbook-gender-dev.jpeg b/public/pubs/handbook-gender-dev.jpeg new file mode 100644 index 0000000..99d7482 Binary files /dev/null and b/public/pubs/handbook-gender-dev.jpeg differ diff --git a/public/pubs/hidden-lives.jpg b/public/pubs/hidden-lives.jpg new file mode 100644 index 0000000..e320130 Binary files /dev/null and b/public/pubs/hidden-lives.jpg differ diff --git a/public/pubs/historiaminimamexico.jpg b/public/pubs/historiaminimamexico.jpg new file mode 100644 index 0000000..ca30e9e Binary files /dev/null and b/public/pubs/historiaminimamexico.jpg differ diff --git a/public/pubs/migration-international.jpg b/public/pubs/migration-international.jpg new file mode 100644 index 0000000..8be215a Binary files /dev/null and b/public/pubs/migration-international.jpg differ diff --git a/public/pubs/salvando_fronteras.jpg b/public/pubs/salvando_fronteras.jpg new file mode 100644 index 0000000..7f41ac9 Binary files /dev/null and b/public/pubs/salvando_fronteras.jpg differ diff --git a/public/pubs/taylor-y-la-migracion-jaliscience.jpg b/public/pubs/taylor-y-la-migracion-jaliscience.jpg new file mode 100644 index 0000000..94a3168 Binary files /dev/null and b/public/pubs/taylor-y-la-migracion-jaliscience.jpg differ diff --git a/src/components/Publications.tsx b/src/components/Publications.tsx new file mode 100644 index 0000000..97f9721 --- /dev/null +++ b/src/components/Publications.tsx @@ -0,0 +1,122 @@ +import React, { useState } from "react" +import Select from "react-select" +import type { InferEntrySchema } from "astro:content" +import type { Classification } from "../content/config.ts" +import PubPlaceholder from "./svg/PubPlaceholder.tsx" + +interface PubProps { + publications: InferEntrySchema<"publications">[] +} + +const PublicationSection: React.FC = ({ publications }) => { + const classificationOptions = [ + { value: "Book", label: "Books" }, + { + value: "Article", + label: "Articles", + }, + { value: "Dissertation", label: "Dissertations" }, + { value: "Chapter", label: "Chapters" }, + ] as const + + const [searchInput, setSearchInput] = useState("") + const [classificationFilter, setClassificationFilter] = + useState>(classificationOptions) + const handleChange = (e: React.ChangeEvent) => { + e.preventDefault() + setSearchInput(e.target.value) + } + + const shownPubs = publications.filter( + (pub) => + classificationFilter.map((item) => item.value).includes(pub.classification) && + pub.citation.toLowerCase().includes(searchInput.toLowerCase()) + ) + return ( + <> +
+
+ + +
+
+ +