Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OEL-2819 : Pattern card customizable #381

Open
wants to merge 4 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions templates/patterns/card/card.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,26 @@ card:
type: string
label: 'Orientation'
description: 'Can be set to horizontal or vertical. Defaults to vertical.'
left_col_classes:
type: string
label: 'Left column classes'
description: 'When horizontal orientation. Classes of left column.'
preview: 'col-3'
right_col_classes:
type: string
label: 'Right column classes'
description: 'When horizontal orientation. Classes of right column.'
preview: 'col-9'
title:
type: text
label: 'Title'
description: 'Card title. Supports markup, e.g. for links.'
preview: 'Title card'
title_tag:
type: text
label: 'Title tag'
description: 'Tag to be used for heading'
preview: 'h5'
subtitle:
type: text
label: 'Subtitle'
Expand Down
7 changes: 5 additions & 2 deletions templates/patterns/card/pattern-card.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
#}
{% apply spaceless %}
{% set _left_col_classes = left_col_classes|default('col-4') %}
{% set _right_col_classes = right_col_classes|default('col-8') %}
{% set _content %}
{% if meta is not empty %}
{# Use negative margin to compensate for me-3 on each item. #}
Expand Down Expand Up @@ -35,11 +37,12 @@
{% include '@oe-bcl/card' with {
'horizontal': orientation == 'horizontal',
'horizontal_grid': (orientation == 'horizontal') ? {
left_col_classes: 'col-4',
right_col_classes: 'col-8',
left_col_classes: _left_col_classes,
right_col_classes: _right_col_classes,
gutter: 0,
} : {},
'title': title,
'title_tag' : title_tag,
'subtitle': (subtitle is not empty) ? {
'content': subtitle,
'classes': 'mb-2',
Expand Down