Skip to content

Commit

Permalink
Add borderless CTA block variant (#5278)
Browse files Browse the repository at this point in the history
* Add borderless CTA block variant

* Remove top padding from borderless CTA

* Update to 4.16.0
  • Loading branch information
jmuzina authored Aug 13, 2024
1 parent 3885de3 commit 8415c0c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vanilla-framework",
"version": "4.15.0",
"version": "4.16.0",
"author": {
"email": "webteam@canonical.com",
"name": "Canonical Webteam"
Expand Down
6 changes: 6 additions & 0 deletions releases.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
- version: 4.16.0
features:
- component: CTA Block / Borderless
url: /docs/patterns/cta-block#borderless
status: New
notes: We've introduced a new borderless variant of the CTA block component.
- version: 4.15.0
features:
- component: CTA Block
Expand Down
7 changes: 7 additions & 0 deletions scss/_patterns_cta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
CTA Block:
.p-cta-block:
Main element of the CTA block.
"&.is-borderless":
Borderless variant, to be used to hide top border and padding.
*/

@import 'settings';
Expand All @@ -16,5 +18,10 @@
flex-wrap: wrap;
padding-bottom: $spv--x-large;
padding-top: $spv--small;

&.is-borderless {
border: none;
padding-top: 0;
}
}
}
12 changes: 12 additions & 0 deletions templates/docs/examples/patterns/cta-block/borderless.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "_layouts/examples.html" %}

{% block title %}CTA Block / Borderless{% endblock %}

{% block standalone_css %}patterns_cta{% endblock %}

{% block content %}
<div class="p-cta-block is-borderless">
<a href="#" class="p-button--positive">Learn more</a>
<a href="#">Contact us ›</a>
</div>
{% endblock %}
11 changes: 11 additions & 0 deletions templates/docs/examples/patterns/cta-block/combined.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends "_layouts/examples.html" %}
{% block title %}CTA Block / Combined{% endblock %}

{% block standalone_css %}patterns_cta{% endblock %}

{% block content %}
{% with is_combined = true %}
<section>{% include 'docs/examples/patterns/cta-block/default.html' %}</section>
<section>{% include 'docs/examples/patterns/cta-block/borderless.html' %}</section>
{% endwith %}
{% endblock %}
2 changes: 1 addition & 1 deletion templates/docs/examples/patterns/cta-block/default.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "_layouts/examples.html" %}

{% block title %}CTA Block{% endblock %}
{% block title %}CTA Block / Default{% endblock %}

{% block standalone_css %}patterns_cta{% endblock %}

Expand Down
8 changes: 8 additions & 0 deletions templates/docs/patterns/cta-block/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ A CTA (call to action) block is a pattern that is used to encourage users to tak
View example of the CTA block pattern
</a></div>

## Borderless

The CTA block can be used without a border. This is useful when the CTA block is stacked beneath related content.

<div class="embedded-example"><a href="/docs/examples/patterns/cta-block/borderless" class="js-example">
View example of the CTA block pattern with no border
</a></div>

## Class reference

{{ class_reference("cta-block") }}
Expand Down

0 comments on commit 8415c0c

Please sign in to comment.