From 57fcc3239d6437fb6b76a404c9f5d3148dbda864 Mon Sep 17 00:00:00 2001
From: Jennifer Dust <49066-jldust@users.noreply.drupalcode.org>
Date: Wed, 31 Jan 2024 18:10:48 +0000
Subject: [PATCH] Issue #3413130 by jldust, pdureau: SDC components: Fix JSON
 schema usage

---
 .../breadcrumbs/breadcrumbs.component.yml     |  4 +-
 .../breadcrumbs/breadcrumbs.stories.yml       | 12 ++--
 components/breadcrumbs/breadcrumbs.twig       | 28 ++++----
 components/button/{ => src}/button.scss       |  0
 components/teaser/teaser.component.yml        | 70 +++++++++----------
 components/teaser/teaser.twig                 |  2 +-
 templates/navigation/breadcrumb.html.twig     |  3 +-
 templates/page/page.html.twig                 |  8 ++-
 8 files changed, 63 insertions(+), 64 deletions(-)
 rename components/button/{ => src}/button.scss (100%)

diff --git a/components/breadcrumbs/breadcrumbs.component.yml b/components/breadcrumbs/breadcrumbs.component.yml
index 26ff9553..c2eb07b0 100644
--- a/components/breadcrumbs/breadcrumbs.component.yml
+++ b/components/breadcrumbs/breadcrumbs.component.yml
@@ -12,9 +12,9 @@ props:
       items:
         type: object
         properties:
-          title:
+          text:
             type: string
-            title: Title
+            title: Text
             examples:
               - "Home"
           url:
diff --git a/components/breadcrumbs/breadcrumbs.stories.yml b/components/breadcrumbs/breadcrumbs.stories.yml
index 0e7d2533..43b823c6 100644
--- a/components/breadcrumbs/breadcrumbs.stories.yml
+++ b/components/breadcrumbs/breadcrumbs.stories.yml
@@ -1,14 +1,14 @@
 title: Breadcrumb
 args:
   items:
-    - title: "Home"
-      url: "/"
+    - text: 'Home'
+      url: '/'
       current: false
-    - title: "Events"
-      url: "/events"
+    - text: 'Events'
+      url: '/events'
       current: false
-    - title: "Event example title"
-      url: "/event/test"
+    - text: 'Event example title'
+      url: '/event/test'
       current: true
 stories:
   - name: Default
diff --git a/components/breadcrumbs/breadcrumbs.twig b/components/breadcrumbs/breadcrumbs.twig
index bfb2ad94..b7a69dcf 100644
--- a/components/breadcrumbs/breadcrumbs.twig
+++ b/components/breadcrumbs/breadcrumbs.twig
@@ -1,17 +1,17 @@
-<nav aria-label="Breadcrumb" {{ attributes.addClass('c-breadcrumb') }}>
+<nav role='navigation' aria-label='Breadcrumb' {{ attributes.addClass('c-breadcrumb') }}>
   {% block breadcrumbs_block %}
-  <ol class="c-breadcrumb__list">
-    {% for item in items %}
-      {% if item.is_current_page == true %}
-        <li class="c-breadcrumb__item">
-          <a href="{{item.url}}" aria-current="page">{{item.title}}</a>
-        </li>
-      {% else %}
-        <li class="c-breadcrumb__item">
-          <a href="{{item.url}}">{{item.title}}</a>
-        </li>
-      {% endif %}
-    {% endfor %}
-  </ol>
+    <ol class='c-breadcrumb__list'>
+      {% for item in items %}
+        {% if item.is_current_page == true %}
+          <li class='c-breadcrumb__item'>
+            <a href="{{item.url}}" aria-current='page'>{{item.text}}</a>
+          </li>
+        {% else %}
+          <li class='c-breadcrumb__item'>
+            <a href="{{item.url}}">{{item.text}}</a>
+          </li>
+        {% endif %}
+      {% endfor %}
+    </ol>
   {% endblock %}
 </nav>
diff --git a/components/button/button.scss b/components/button/src/button.scss
similarity index 100%
rename from components/button/button.scss
rename to components/button/src/button.scss
diff --git a/components/teaser/teaser.component.yml b/components/teaser/teaser.component.yml
index 48140958..09fab2a8 100644
--- a/components/teaser/teaser.component.yml
+++ b/components/teaser/teaser.component.yml
@@ -1,6 +1,6 @@
 $schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json
 name: Teaser
-status: "experimental"
+status: 'experimental'
 description: A Teaser component
 props:
   type: object
@@ -18,37 +18,35 @@ props:
         - list-stack
         - super
     alt:
-      type: "string"
-      title: "Image Alt Text"
-      description: "The alt text for the image."
+      type: 'string'
+      title: 'Image Alt Text'
+      description: 'The alt text for the image.'
       examples:
-        - "Ea irure adipisicing"
+        - 'Ea irure adipisicing'
     image:
-      type: "string"
-      title: "image URL"
-      description: "The url for the image"
-      examples:
-        - ""
+      type: 'string'
+      title: 'image URL'
+      description: 'The url for the image'
     title:
-      type: "string"
-      title: "Title"
+      type: 'string'
+      title: 'Title'
       examples:
-        - "A new exhibit opens at the Student Visitor Center"
+        - 'A new exhibit opens at the Student Visitor Center'
     url:
-      type: "string"
-      title: "Teaser URL"
+      type: 'string'
+      title: 'Teaser URL'
       examples:
-        - "https://github.com"
+        - 'https://github.com'
     category:
-      type: "string"
-      title: "Category"
+      type: 'string'
+      title: 'Category'
       examples:
-        - "Article"
+        - 'Article'
     category_url:
-      type: "string"
-      title: "Category URL"
+      type: 'string'
+      title: 'Category URL'
       examples:
-        - "https://github.com"
+        - 'https://github.com'
     category_color:
       type: string
       title: Category Color
@@ -58,20 +56,20 @@ props:
         - kelly
         - gold
     teaser_date:
-      type: "string"
-      title: "Date"
+      type: 'string'
+      title: 'Date'
       examples:
-        - "August 18, 2024"
+        - 'August 18, 2024'
     teaser_time:
-      type: "string"
-      title: "Time"
+      type: 'string'
+      title: 'Time'
       examples:
-        - "4:00pm - 6:00pm"
+        - '4:00pm - 6:00pm'
     body:
       title: Body
       type: string
       examples:
-        - "<p>The human body is a marvel and does so amazing things for us everyday.</p>"
+        - '<p>The human body is a marvel and does so amazing things for us everyday.</p>'
     icon:
       type: string
       title: Category icon
@@ -80,18 +78,18 @@ props:
     tags:
       type: array
       title: Tags
-      tags:
+      items:
         type: object
         properties:
-          title:
-            type: string
-            title: Title
-            examples:
-              - "Tag one"
-              - "Tag two"
           url:
             type: string
             title: Tag URL
             examples:
               - https://github.com
               - https://github.com
+          title:
+            type: string
+            title: Title
+            examples:
+              - 'Tag one'
+              - 'Tag two'
diff --git a/components/teaser/teaser.twig b/components/teaser/teaser.twig
index a6d92b80..d8b69bef 100644
--- a/components/teaser/teaser.twig
+++ b/components/teaser/teaser.twig
@@ -108,7 +108,7 @@
 				{% block tags_block %}
 					{% for key, tag in tags %}
 						<li class="c-teaser__tag">
-							<a href="{{tag.title}}">{{tag.title}}</a>
+							<a href="{{tag.url}}">{{tag.title}}</a>
 						</li>
 					{% endfor %}
 				{% endblock %}
diff --git a/templates/navigation/breadcrumb.html.twig b/templates/navigation/breadcrumb.html.twig
index 034898e3..b4d05ec5 100755
--- a/templates/navigation/breadcrumb.html.twig
+++ b/templates/navigation/breadcrumb.html.twig
@@ -1,6 +1,5 @@
 {{
   include('prototype:breadcrumbs', {
-    breadcrumbs: breadcrumbs,
-    separator: '|',
+    items: breadcrumb,
   })
 }}
diff --git a/templates/page/page.html.twig b/templates/page/page.html.twig
index 7290acaf..226ce63b 100755
--- a/templates/page/page.html.twig
+++ b/templates/page/page.html.twig
@@ -17,9 +17,11 @@
 	{# /header #}
 
 	{% if breadcrumb %}
-		{{ include('prototype:breadcrumbs', {
-			breadcrumbs: page.breadcrumb,
-		}) }}
+		{{
+			include('prototype:breadcrumbs', {
+        items: breadcrumbs,
+		  })
+    }}
 	{% endif %}
 	{# /breadcrumb #}
 
-- 
GitLab