-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cta component and examples (#451)
* Added cta component and examples - WIP * Created variable for census purple * Added theme to cta example * Added color variable * Added parameter for button text * Updated cta to use h2 and p
- Loading branch information
1 parent
8308bbd
commit bf025f9
Showing
11 changed files
with
90 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.call-to-action { | ||
padding: 0.85rem 0; | ||
background: $cta-bg; | ||
} |
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,21 @@ | ||
{% macro onsCallToAction(params) %} | ||
{% from "components/button/_macro.njk" import onsButton %} | ||
<div class="call-to-action"> | ||
<div class="container"> | ||
<div class="grid grid--flex grid--vertical-center grid--no-wrap@s"> | ||
<div class="grid__col col-auto u-flex-shrink@s"> | ||
<h2 class="u-fs-r--b u-di">{{ params.headingText }}</h2> | ||
<p class="u-di">{{ params.paragraphText }}</p> | ||
</div> | ||
<div class="grid__col col-auto u-flex-no-grow u-mt-xs@xs@s"> | ||
{{ onsButton({ | ||
"text": params.button.text, | ||
"url": params.button.url, | ||
"classes": "btn--small", | ||
"innerClasses": "icon--chevron-right-white" | ||
})}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endmacro %} |
16 changes: 16 additions & 0 deletions
16
src/components/call-to-action/examples/call-to-action-census/index.njk
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,16 @@ | ||
--- | ||
"theme": census | ||
--- | ||
{% from "components/call-to-action/_macro.njk" import onsCallToAction %} | ||
{{- | ||
onsCallToAction({ | ||
"headingText": "Ready to start your census survey?", | ||
"paragraphText": "You'll need the access code from the letter we sent you.", | ||
"button": { | ||
"text": "Start survey", | ||
"classes": 'btn--small', | ||
"innerClasses": "icon--chevron-right-white", | ||
"url": "#" | ||
} | ||
}) | ||
}} |
13 changes: 13 additions & 0 deletions
13
src/components/call-to-action/examples/call-to-action-default/index.njk
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 @@ | ||
{% from "components/call-to-action/_macro.njk" import onsCallToAction %} | ||
{{- | ||
onsCallToAction({ | ||
"headingText": "Call to action heading.", | ||
"paragraphText": "Descriptive text about call to action", | ||
"button": { | ||
"text": "Start", | ||
"classes": 'btn--small', | ||
"innerClasses": "icon--chevron-right-white", | ||
"url": "#" | ||
} | ||
}) | ||
}} |
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,16 @@ | ||
--- | ||
title: Call to action | ||
--- | ||
{% from "views/partials/example/_macro.njk" import patternlibExample %} | ||
|
||
Documentation required | ||
|
||
## Call to action - default | ||
{{ | ||
patternlibExample({"path": "components/call-to-action/examples/call-to-action-default/index.njk"}) | ||
}} | ||
|
||
## Call to action - census | ||
{{ | ||
patternlibExample({"path": "components/call-to-action/examples/call-to-action-census/index.njk"}) | ||
}} |
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 |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
display: inline-block; | ||
} | ||
|
||
.u-di { | ||
display: inline; | ||
} | ||
|
||
.u-db { | ||
display: block; | ||
} | ||
|
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