Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AudienceTopics styles and add types #367

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions src/data/queries/audienceTopics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { ParagraphAudienceTopics } from '@/types/drupal/paragraph'
import { QueryFormatter } from 'next-drupal-query'
import { AudienceTopic } from '@/types/formatted/audienceTopics'

const getTagsList = (fieldTags) => {
if (!fieldTags) return null
const getTagsList = (
entity: ParagraphAudienceTopics
): AudienceTopic[] | null => {
if (!entity) return null

const {
field_topics: fieldTopics = [],
field_audience_beneficiares: fieldAudienceBeneficiares,
fieldNonBeneficiares: fieldNonBeneficiares,
} = fieldTags
} = entity

const topics = fieldTopics.map((topic) => ({
id: topic.id,
Expand Down
7 changes: 4 additions & 3 deletions src/templates/components/audienceTopics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ export function AudienceTopics({ tags }: FormattedAudienceTopics) {
if (isEmpty(tags)) return null
const tagsList = tags.map(({ id, href, name }) => (
<div key={id}>
<div className="vads-u-margin-right--1 vads-u-margin-bottom--1 medium-screen:vads-u-margin-bottom--0">
<div className="vads-u-margin-right--1 vads-u-margin-bottom--1 medium-screen:vads-u-margin-bottom--1p5">
<Link
href={`${href}/${encodeURI(name)}`}
className="vads-u-margin-bottom--1p5 usa-button-secondary vads-u-font-size--sm vads-u-border--1px vads-u-border-color--primary vads-u-padding--0p25 vads-u-padding-x--0p5 vads-u-margin-left--1p5 vads-u-text-decoration--none vads-u-color--base"
href={href}
className="usa-button-secondary vads-u-font-size--sm vads-u-border--1px vads-u-border-color--primary vads-u-padding--0p25 vads-u-padding-x--0p5 vads-u-margin-left--1p5 vads-u-text-decoration--none vads-u-color--base"
style={{ borderRadius: '3px', lineHeight: '1.3' }}
>
{name}
</Link>
Expand Down
Loading