Skip to content

Commit

Permalink
CTA Block component (#5196)
Browse files Browse the repository at this point in the history
Co-authored-by: Bartek Szopka <[email protected]>
  • Loading branch information
jmuzina and bartaz authored Jul 17, 2024
1 parent fea4471 commit 6f1225d
Show file tree
Hide file tree
Showing 8 changed files with 79 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.14.1",
"version": "4.15.0",
"author": {
"email": "[email protected]",
"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.15.0
features:
- component: CTA Block
url: /docs/patterns/cta-block
status: New
notes: We've introduced a new CTA block component.
- version: 4.14.0
features:
- component: Links / Anchor headings
Expand Down
20 changes: 20 additions & 0 deletions scss/_patterns_cta.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
@classreference
cta-block:
CTA Block:
.p-cta-block:
Main element of the CTA block.
*/

@import 'settings';

@mixin vf-p-cta-block {
.p-cta-block {
align-items: baseline;
border-top: 1px solid $colors--theme--border-low-contrast;
display: flex;
flex-wrap: wrap;
padding-bottom: $spv--x-large;
padding-top: $spv--small;
}
}
2 changes: 2 additions & 0 deletions scss/_vanilla.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@import 'patterns_chip';
@import 'patterns_code-snippet';
@import 'patterns_contextual-menu';
@import 'patterns_cta';
@import 'patterns_divider';
@import 'patterns_equal-height-row';
@import 'patterns_form-help-text';
Expand Down Expand Up @@ -104,6 +105,7 @@
@include vf-p-chip;
@include vf-p-code-snippet;
@include vf-p-contextual-menu;
@include vf-p-cta-block;
@include vf-p-divider;
@include vf-p-equal-height-row;
@include vf-p-form-help-text;
Expand Down
5 changes: 5 additions & 0 deletions scss/standalone/patterns_cta.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import '../vanilla';
@include vf-base;

@include vf-p-cta-block;
@include vf-p-buttons;
3 changes: 2 additions & 1 deletion side-navigation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
url: /docs/base/typography
- title: Paper background
url: /docs/base/paper

- heading: Components
ordering: alphabetical
subheadings:
Expand All @@ -47,6 +46,8 @@
url: /docs/patterns/chip
- title: Contextual menu
url: /docs/patterns/contextual-menu
- title: CTA Block
url: /docs/patterns/cta-block
- title: Divider
url: /docs/patterns/divider
- title: Empty state
Expand Down
11 changes: 11 additions & 0 deletions templates/docs/examples/patterns/cta-block/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends "_layouts/examples.html" %}
{% block title %}CTA Block{% endblock %}

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

{% block content %}
<div class="p-cta-block">
<button class="p-button--positive">Learn more</button>
<a href="#">Contact us ›</a>
</div>
{% endblock %}
32 changes: 32 additions & 0 deletions templates/docs/patterns/cta-block/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
collection: patterns
wrapper_template: '_layouts/docs.html'
context:
title: CTA Block | Patterns
---

A CTA (call to action) block is a pattern that is used to encourage users to take a specific action. This could be to learn more details about a product, contact someone, or to download a file.

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

## Class reference

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

## Import

To import just this component into your project, copy the snippet below and include it in your main Sass file.

```scss
// import Vanilla and include base mixins
// this only needs to happen once in a given project
@import 'vanilla-framework';
@include vf-base;

@include vf-p-cta-block;
@include vf-p-buttons;
```

For more information see [Customising Vanilla](/docs/customising-vanilla/) in your projects, which includes overrides and importing instructions.

0 comments on commit 6f1225d

Please sign in to comment.