-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUP-197 SUP-182 Stubbed out search and file list components
- Loading branch information
Showing
14 changed files
with
652 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/components/paragraphs/sup-file-list/file-list-paragraph.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"use client"; | ||
|
||
import {HtmlHTMLAttributes, useState} from "react"; | ||
import {ParagraphSupFileList} from "@lib/gql/__generated__/drupal.d"; | ||
import SelectList from "@components/elements/select-list"; | ||
import Link from "@components/elements/link"; | ||
|
||
type Props = HtmlHTMLAttributes<HTMLDivElement> & { | ||
paragraph: ParagraphSupFileList | ||
} | ||
|
||
const FileListParagraph = ({paragraph, ...props}: Props) => { | ||
const [chosenFile, setChosenFile] = useState<string|null>(null) | ||
const fileOptions = paragraph.supFileListFiles.map(media => ({value: media.id, label: media.name})) | ||
|
||
const chosenItem = paragraph.supFileListFiles.find(media => media.id === chosenFile); | ||
return ( | ||
<div {...props}> | ||
<div className="mb-10"> | ||
<SelectList | ||
options={fileOptions} | ||
label="Choose a file" | ||
onChange={(_e, v) => setChosenFile(v as string)} | ||
/> | ||
</div> | ||
{chosenItem && | ||
<Link className="button" href={chosenItem.mediaFile.url} download prefetch={false}>Download</Link> | ||
} | ||
</div> | ||
) | ||
} | ||
export default FileListParagraph |
15 changes: 15 additions & 0 deletions
15
src/components/paragraphs/sup-pre-built/pre-built-paragraph.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {HtmlHTMLAttributes} from "react"; | ||
import {ParagraphSupPreBuilt} from "@lib/gql/__generated__/drupal.d"; | ||
import PrebuiltSearchForm from "@components/paragraphs/sup-pre-built/pre-built-search-form"; | ||
|
||
type Props = HtmlHTMLAttributes<HTMLDivElement> & { | ||
paragraph: ParagraphSupPreBuilt | ||
} | ||
|
||
const PreBuiltParagraph = ({paragraph, ...props}: Props) => { | ||
switch (paragraph.supPrebuiltComponent) { | ||
case "search_form": | ||
return <PrebuiltSearchForm {...props}/> | ||
} | ||
} | ||
export default PreBuiltParagraph |
13 changes: 13 additions & 0 deletions
13
src/components/paragraphs/sup-pre-built/pre-built-search-form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {HTMLAttributes} from "react"; | ||
import SiteSearchForm from "@components/search/site-search-form"; | ||
|
||
type Props = HTMLAttributes<HTMLDivElement>; | ||
|
||
const PrebuiltSearchForm = ({...props}: Props) => { | ||
return ( | ||
<div {...props}> | ||
<SiteSearchForm/> | ||
</div> | ||
) | ||
} | ||
export default PrebuiltSearchForm; |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
fragment FragmentSuPolicyLog on SuPolicyLog { | ||
__typename | ||
id | ||
suPolicyDate { | ||
...FragmentDateTime | ||
} | ||
suPolicyNotes | ||
suPolicyPublic | ||
suPolicyTitle | ||
} | ||
|
||
fragment FragmentTermInterface on TermInterface { | ||
__typename | ||
id | ||
name | ||
path | ||
weight | ||
parent { | ||
... on TermInterface { | ||
id | ||
} | ||
} | ||
} | ||
|
||
fragment FragmentSupAward on SupAward { | ||
id | ||
supAssociation | ||
supDescription { | ||
processed | ||
} | ||
supPlace | ||
supRank | ||
supWorkId | ||
supYear | ||
} | ||
|
||
fragment FragmentNameType on NameType { | ||
title | ||
given | ||
middle | ||
family | ||
generational | ||
credentials | ||
} | ||
|
||
fragment FragmentDateTime on DateTime { | ||
timezone | ||
time | ||
} | ||
|
||
fragment FragmentSmartDateType on SmartDateType { | ||
value | ||
end_value | ||
timezone | ||
rrule_index | ||
rrule | ||
} | ||
|
||
fragment FragmentAddressType on Address { | ||
langcode | ||
country { | ||
name | ||
code | ||
} | ||
givenName | ||
additionalName | ||
familyName | ||
organization | ||
addressLine1 | ||
addressLine2 | ||
postalCode | ||
sortingCode | ||
dependentLocality | ||
locality | ||
administrativeArea | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
fragment FragmentMediaInterface on MediaInterface { | ||
__typename | ||
id | ||
name | ||
} | ||
|
||
fragment FragmentMediaFile on MediaFile { | ||
...FragmentMediaInterface | ||
mediaFile { | ||
url | ||
} | ||
} | ||
|
||
fragment FragmentMediaEmbeddable on MediaEmbeddable { | ||
...FragmentMediaInterface | ||
mediaEmbeddableCode | ||
mediaEmbeddableOembed | ||
} | ||
|
||
fragment FragmentMediaGoogleForm on MediaGoogleForm { | ||
...FragmentMediaInterface | ||
mediaGoogleForm | ||
mediaGoogleForm | ||
} | ||
|
||
fragment FragmentMediaImage on MediaImage { | ||
...FragmentMediaInterface | ||
mediaImage { | ||
url | ||
alt | ||
height | ||
width | ||
} | ||
} | ||
|
||
fragment FragmentMediaStanfordGalleryImage on MediaStanfordGalleryImage { | ||
...FragmentMediaInterface | ||
suGalleryCaption | ||
suGalleryImage { | ||
url | ||
alt | ||
height | ||
width | ||
} | ||
} | ||
|
||
fragment FragmentMediaVideo on MediaVideo { | ||
...FragmentMediaInterface | ||
mediaOembedVideo | ||
} | ||
|
||
fragment FragmentMediaUnion on MediaUnion { | ||
...FragmentMediaEmbeddable | ||
...FragmentMediaFile | ||
...FragmentMediaGoogleForm | ||
...FragmentMediaImage | ||
...FragmentMediaStanfordGalleryImage | ||
...FragmentMediaVideo | ||
} |
Oops, something went wrong.