From dfaeef992048ea633cc2c8275d5a7b750813053c Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 20 Nov 2024 13:42:56 -0600 Subject: [PATCH 1/2] fix(IYY-263): add header icon prefix, include in search results --- .../01-atoms/typography/headings/yds-heading.twig | 9 +++++++++ .../search-result/_yds-search-result.scss | 11 +++++++++++ .../search-result/yds-search-result.stories.js | 13 ++++++++++++- .../search-result/yds-search-result.twig | 4 +++- images/icons/lock-solid.svg | 1 + 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 images/icons/lock-solid.svg diff --git a/components/01-atoms/typography/headings/yds-heading.twig b/components/01-atoms/typography/headings/yds-heading.twig index fa3056859..65afe2784 100644 --- a/components/01-atoms/typography/headings/yds-heading.twig +++ b/components/01-atoms/typography/headings/yds-heading.twig @@ -15,6 +15,15 @@ {% set heading__base_class = heading__base_class|default('heading') %} + {% if heading__prefix__icon %} + + {% include "@atoms/images/icons/_yds-icon.twig" with { + icon__name: heading__prefix__icon, + icon__modifiers: heading__prefix__icon__modifiers, + icon__blockname: heading__prefix__icon__blockname|default(heading__blockname), + } %} + + {% endif %} {% if heading__prefix %} {{ heading__prefix }} diff --git a/components/02-molecules/search-result/_yds-search-result.scss b/components/02-molecules/search-result/_yds-search-result.scss index 138d683ec..185cb0610 100644 --- a/components/02-molecules/search-result/_yds-search-result.scss +++ b/components/02-molecules/search-result/_yds-search-result.scss @@ -82,6 +82,17 @@ @include tokens.h4-yale-new; color: var(--color-gray-800); + + &:has(.heading__prefix-icon) { + display: flex; + align-items: center; + gap: var(--size-spacing-3); + } +} + +.search-result__icon { + width: var(--size-spacing-5); + height: var(--size-spacing-5); } .search-result__highlighted, diff --git a/components/02-molecules/search-result/yds-search-result.stories.js b/components/02-molecules/search-result/yds-search-result.stories.js index 44ef89728..053291564 100644 --- a/components/02-molecules/search-result/yds-search-result.stories.js +++ b/components/02-molecules/search-result/yds-search-result.stories.js @@ -28,6 +28,10 @@ export default { type: 'string', defaultValue: searchResultData.search_result__content_type, }, + isCas: { + name: 'Is CAS', + type: 'boolean', + }, }, args: { heading: searchResultData.search_result__title, @@ -36,7 +40,13 @@ export default { }, }; -export const SearchResult = ({ heading, highlighted, teaser, contentType }) => +export const SearchResult = ({ + heading, + highlighted, + teaser, + contentType, + isCas, +}) => searchResultTwig({ search_result__teaser: teaser, search_result__title: heading, @@ -44,4 +54,5 @@ export const SearchResult = ({ heading, highlighted, teaser, contentType }) => search_result__highlighted: highlighted, breadcrumbs__items: breadcrumbData.items, search_result__content_type: contentType, + search_result__prefix__icon: isCas ? 'lock-solid' : '', }); diff --git a/components/02-molecules/search-result/yds-search-result.twig b/components/02-molecules/search-result/yds-search-result.twig index 31e26102e..4941c3c8e 100644 --- a/components/02-molecules/search-result/yds-search-result.twig +++ b/components/02-molecules/search-result/yds-search-result.twig @@ -17,13 +17,15 @@
{{ search_result__content_type }}
+ {% include "@atoms/typography/headings/yds-heading.twig" with { heading__level: '2', heading__blockname: search_result__base_class, heading: search_result__title, heading__url: search_result__url, + heading__prefix__icon: search_result__prefix__icon, } %} - + {{'hello, are you here?'}} {% include "@organisms/menu/breadcrumbs/yds-breadcrumbs.twig" with { breadcrumbs__modifiers: search_result__base_class } %} diff --git a/images/icons/lock-solid.svg b/images/icons/lock-solid.svg new file mode 100644 index 000000000..ad99cf24b --- /dev/null +++ b/images/icons/lock-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file From 221669fe150fb4f1bb5360b2c71d885693d09d0e Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 20 Nov 2024 14:24:30 -0600 Subject: [PATCH 2/2] feat(IYY-262): add check for is_cas, hide search result content in CL if is_cas --- .../yds-search-result.stories.js | 1 + .../search-result/yds-search-result.twig | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/components/02-molecules/search-result/yds-search-result.stories.js b/components/02-molecules/search-result/yds-search-result.stories.js index 053291564..b7c25e074 100644 --- a/components/02-molecules/search-result/yds-search-result.stories.js +++ b/components/02-molecules/search-result/yds-search-result.stories.js @@ -55,4 +55,5 @@ export const SearchResult = ({ breadcrumbs__items: breadcrumbData.items, search_result__content_type: contentType, search_result__prefix__icon: isCas ? 'lock-solid' : '', + is_cas: isCas, }); diff --git a/components/02-molecules/search-result/yds-search-result.twig b/components/02-molecules/search-result/yds-search-result.twig index 4941c3c8e..747c0a61f 100644 --- a/components/02-molecules/search-result/yds-search-result.twig +++ b/components/02-molecules/search-result/yds-search-result.twig @@ -25,23 +25,26 @@ heading__url: search_result__url, heading__prefix__icon: search_result__prefix__icon, } %} - {{'hello, are you here?'}} - {% include "@organisms/menu/breadcrumbs/yds-breadcrumbs.twig" with { - breadcrumbs__modifiers: search_result__base_class - } %} - {% if search_result__highlighted %} - {% include "@atoms/typography/text/yds-text.twig" with { - text__base_class: 'highlighted', - text__blockname: search_result__base_class, - text__content: search_result__highlighted, - } %} - {% endif %} - {% if search_result__teaser %} - {% include "@atoms/typography/text/yds-text.twig" with { - text__base_class: 'teaser', - text__blockname: search_result__base_class, - text__content: search_result__teaser, + + {% if not is_cas %} + {% include "@organisms/menu/breadcrumbs/yds-breadcrumbs.twig" with { + breadcrumbs__modifiers: search_result__base_class } %} + + {% if search_result__highlighted %} + {% include "@atoms/typography/text/yds-text.twig" with { + text__base_class: 'highlighted', + text__blockname: search_result__base_class, + text__content: search_result__highlighted, + } %} + {% endif %} + {% if search_result__teaser %} + {% include "@atoms/typography/text/yds-text.twig" with { + text__base_class: 'teaser', + text__blockname: search_result__base_class, + text__content: search_result__teaser, + } %} + {% endif %} {% endif %}