Skip to content

Commit

Permalink
Added handlebars each and used a partial
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenhitchon committed Nov 27, 2023
1 parent de2683c commit 118c510
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 77 deletions.
37 changes: 24 additions & 13 deletions src/components/carousel/_carousel-card.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
<li class="nsw-carousel__item nsw-col nsw-col-md-6 nsw-col-lg-4">
<div class="nsw-card">
<div class="nsw-card__content">
<div class="nsw-card__title">
<a href="#">1</a>
</div>
<div class="nsw-card__copy">
<p>Helps you compare electricity and gas and switch providers.</p>
</div>
<span class="material-icons nsw-material-icons" focusable="false" aria-hidden="true">east</span>
</div>
</div>
</li>
<div class="nsw-carousel__wrapper">
<ol class="nsw-carousel__list nsw-grid">
{{#each cards}}
<li class="nsw-carousel__item nsw-col nsw-col-md-6 nsw-col-lg-4">
<div class="nsw-card nsw-card--headline">
{{#if img}}
<div class="nsw-card__image">
<img src="{{img}}" alt="{{heading}}">
</div>
{{/if}}
<div class="nsw-card__content">
<div class="nsw-card__title">
<a href="#">{{heading}}</a>
</div>{{#if copy}}
<div class="nsw-card__copy">
<p>{{copy}}</p>
</div>{{/if}}
<span class="material-icons nsw-material-icons" focusable="false" aria-hidden="true">east</span>
</div>
</div>
</li>
{{/each}}
</ol>
</div>
68 changes: 4 additions & 64 deletions src/components/carousel/_carousel.hbs
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
<div class="nsw-carousel js-carousel" data-drag="on">
<p class="sr-only">Carousel items</p>

<div class="nsw-carousel__wrapper">
<ol class="nsw-carousel__list nsw-grid">
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
</ol>
</div>
{{>_carousel-card}}

<nav>
<ul>
Expand Down Expand Up @@ -45,22 +30,7 @@
<div class="nsw-carousel js-carousel" data-drag="on" data-loop="off" data-navigation="on" data-navigation-class="nsw-carousel__navigation">
<p class="sr-only">Carousel items</p>

<div class="nsw-carousel__wrapper">
<ol class="nsw-carousel__list nsw-grid">
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
</ol>
</div>
{{>_carousel-card}}

<nav>
<ul>
Expand Down Expand Up @@ -89,22 +59,7 @@
<div class="nsw-carousel js-carousel" data-drag="on" data-loop="off">
<p class="sr-only">Carousel items</p>

<div class="nsw-carousel__wrapper">
<ol class="nsw-carousel__list nsw-grid">
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
</ol>
</div>
{{>_carousel-card}}

<div class="nsw-carousel__counter">
<p><i class="js-carousel__counter"></i> / <i class="js-carousel__counter-tot"></i></p>
Expand Down Expand Up @@ -135,22 +90,7 @@
<div class="nsw-carousel js-carousel" data-drag="on" data-loop="off" data-navigation="on" data-navigation-class="nsw-carousel__navigation nsw-carousel__navigation--pagination" data-navigation-pagination="on">
<p class="sr-only">Carousel items</p>

<div class="nsw-carousel__wrapper">
<ol class="nsw-carousel__list nsw-grid">
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
{{>_carousel-card}}
</ol>
</div>
{{>_carousel-card}}

<nav>
<ul>
Expand Down
47 changes: 47 additions & 0 deletions src/components/carousel/json/carousel.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
{
"cards": {
"1": {
"heading": "Nominations open for Green Globe Awards 2019",
"copy": "The annual awards will recognise individuals and organisations for their leadership , commitment and innovation in sustainability across NSW.",
"img": "https://picsum.photos/id/292/400/200"
},
"2": {
"heading": "Quality green spaces and a million more trees for NSW",
"copy": "The NSW Government will create more quality green spaces and increase ther tree canopy in Sydney bt 2022.",
"img": "https://picsum.photos/id/28/400/200"
},
"3": {
"heading": "New Premier's Priority to lift literacy and numeracy standards",
"copy": "The NSW Government will redouble its efforts to lift literacy and numeracy standards across NSW public schools to ensure students are given every opportunity to be their best.",
"img": "https://picsum.photos/id/268/400/200"
},
"4": {
"heading": "Nominations open for Green Globe Awards 2019",
"copy": "The annual awards will recognise individuals and organisations for their leadership , commitment and innovation in sustainability across NSW.",
"img": "https://picsum.photos/id/222/400/200"
},
"5": {
"heading": "Quality green spaces and a million more trees for NSW",
"copy": "The NSW Government will create more quality green spaces and increase ther tree canopy in Sydney bt 2022.",
"img": "https://picsum.photos/id/238/400/200"
},
"6": {
"heading": "New Premier's Priority to lift literacy and numeracy standards",
"copy": "The NSW Government will redouble its efforts to lift literacy and numeracy standards across NSW public schools to ensure students are given every opportunity to be their best.",
"img": "https://picsum.photos/id/208/400/200"
},
"7": {
"heading": "Nominations open for Green Globe Awards 2019",
"copy": "The annual awards will recognise individuals and organisations for their leadership , commitment and innovation in sustainability across NSW.",
"img": "https://picsum.photos/id/282/400/200"
},
"8": {
"heading": "Quality green spaces and a million more trees for NSW",
"copy": "The NSW Government will create more quality green spaces and increase ther tree canopy in Sydney bt 2022.",
"img": "https://picsum.photos/id/287/400/200"
},
"9": {
"heading": "New Premier's Priority to lift literacy and numeracy standards",
"copy": "The NSW Government will redouble its efforts to lift literacy and numeracy standards across NSW public schools to ensure students are given every opportunity to be their best.",
"img": "https://picsum.photos/id/238/400/200"
}
}
}

0 comments on commit 118c510

Please sign in to comment.