Skip to content

Commit 79c7800

Browse files
authored
Feature: allow examples of variants (#1689)
* Feature: allow examples of variants Adds technical support to facilitate #1530 by: 1. Adding a new component cotnext variable `isExample: true` 2. Adding template support in the component library While these are technically new variants, they do not generate additional template files and are shown in contextually appropriate way. Incroporating examples also brings some required updates to the layout of the component pages — most of which have been overdue, such as removing the tree layout (whose function is planned to be replaced by the forthcoming mega menu).
1 parent a67ccfb commit 79c7800

File tree

9 files changed

+268
-173
lines changed

9 files changed

+268
-173
lines changed

components/vf-badge/vf-badge.config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ variants:
88
hidden: true
99
context:
1010
text: alpha
11+
theme: primary
1112

1213
- name: primary
1314
context:
@@ -16,16 +17,19 @@ variants:
1617

1718
- name: secondary
1819
context:
20+
isExample: true
1921
text: alpha
2022
theme: secondary
2123

2224
- name: tertiary
2325
context:
26+
isExample: true
2427
text: alpha
2528
theme: tertiary
2629

2730
- name: link - primary
2831
context:
32+
isExample: true
2933
badge_href: "JavaScript:Void(0);"
3034
theme: primary
3135
text: beta

components/vf-card/vf-card.config.yml

+32-22
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Card
33
# Label shown on index pages
44
label: Card
5-
status: beta
5+
status: live
66
# preview: '@preview--nogrid'
77
# The template used from /components/_previews
88
#
@@ -17,28 +17,42 @@ variants:
1717

1818
# Bordered Variants
1919
# -----------------
20-
- name: Bordered Headings
20+
- name: Bordered
2121
context:
2222
card_heading: A Bordered Card Heading
2323
card_subheading: With sub–heading
2424
variant: bordered
2525
newTheme: primary
26+
card_href: "JavaScript:Void(0);"
27+
card_image: https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/2020/04/SCHOOLS_1011_ells-learninglab_hd_01_Cool_500px.jpg
28+
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
29+
card_image__alt: Image alt text
30+
- name: Bordered Headings
31+
context:
32+
isExample: true
33+
card_heading: A Bordered Card Heading as an example
34+
card_subheading: With sub–heading
35+
variant: bordered
36+
newTheme: primary
2637
- name: Bordered Headings with Link
2738
context:
39+
isExample: true
2840
card_heading: A Bordered Card Heading
2941
card_href: "JavaScript:Void(0);"
3042
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
3143
variant: bordered
3244
newTheme: primary
3345
- name: Bordered
3446
context:
47+
isExample: true
3548
card_heading: A Bordered Card Heading
3649
card_subheading: With sub–heading
3750
variant: bordered
3851
newTheme: primary
3952
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
4053
- name: Bordered with Link
4154
context:
55+
isExample: true
4256
card_heading: A Bordered Card Heading
4357
card_subheading: With sub–heading
4458
variant: bordered
@@ -47,80 +61,76 @@ variants:
4761
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
4862
- name: Bordered with Image
4963
context:
64+
isExample: true
5065
card_heading: A Bordered Card Heading
5166
card_subheading: With sub–heading
5267
variant: bordered
5368
newTheme: primary
5469
card_image: https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/2020/04/SCHOOLS_1011_ells-learninglab_hd_01_Cool_500px.jpg
5570
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
5671
card_image__alt: Image alt text
57-
- name: Bordered with Image and Link
72+
- name: Bordered with Image and no Heading
5873
context:
59-
card_heading: A Bordered Card Heading
60-
card_subheading: With sub–heading
74+
isExample: true
6175
variant: bordered
6276
newTheme: primary
63-
card_href: "JavaScript:Void(0);"
6477
card_image: https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/2020/04/SCHOOLS_1011_ells-learninglab_hd_01_Cool_500px.jpg
6578
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
6679
card_image__alt: Image alt text
67-
- name: Bordered with Image and no Heading
80+
81+
# Striped Variants
82+
# ----------------
83+
- name: Striped
6884
context:
69-
variant: bordered
85+
card_heading: A Striped Card Heading
86+
card_subheading: With sub–heading
87+
variant: striped
7088
newTheme: primary
89+
card_href: "JavaScript:Void(0);"
7190
card_image: https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/2020/04/SCHOOLS_1011_ells-learninglab_hd_01_Cool_500px.jpg
7291
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
7392
card_image__alt: Image alt text
74-
75-
# Striped Variants
76-
# ----------------
7793
- name: Striped only Headings
7894
context:
95+
isExample: true
7996
card_heading: A Striped Card Heading
8097
card_subheading: With sub–heading
8198
variant: striped
8299
newTheme: primary
83100
- name: Striped only linked Headings
84101
context:
102+
isExample: true
85103
card_heading: A Striped Card Heading
86104
card_href: "JavaScript:Void(0);"
87105
card_subheading: With sub–heading
88106
variant: striped
89107
newTheme: primary
90108
- name: Striped
91109
context:
110+
isExample: true
92111
card_heading: A Striped Card Heading
93112
card_subheading: With sub–heading
94113
variant: striped
95114
newTheme: primary
96115
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
97116
- name: Striped with Link
98117
context:
118+
isExample: true
99119
card_heading: A Striped Card Heading
100120
variant: striped
101121
newTheme: primary
102122
card_href: "JavaScript:Void(0);"
103123
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
104-
105124
- name: Striped with Image
106125
context:
126+
isExample: true
107127
card_heading: A Striped Card Heading
108128
card_subheading: With sub–heading
109129
variant: striped
110130
newTheme: primary
111131
card_image: https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/2020/04/SCHOOLS_1011_ells-learninglab_hd_01_Cool_500px.jpg
112132
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
113133
card_image__alt: Image alt text
114-
- name: Striped with Image and Link
115-
context:
116-
card_heading: A Striped Card Heading
117-
card_subheading: With sub–heading
118-
variant: striped
119-
newTheme: primary
120-
card_href: "JavaScript:Void(0);"
121-
card_image: https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/2020/04/SCHOOLS_1011_ells-learninglab_hd_01_Cool_500px.jpg
122-
card_text: Lorem ipsum dolor sit amet, consectetur <a href="JavaScript:Void(0);" class="vf-card__link">adipisicing elit</a>. Sapiente harum, omnis provident saepe aut eius aliquam sequi fugit incidunt reiciendis, mollitia quos?
123-
card_image__alt: Image alt text
124134

125135

126136

components/vf-embed/vf-embed.config.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,23 @@ variants:
1111
label: 16x9
1212
context:
1313
vf_embed_variant_16x9: true
14-
1514
- name: 4x3
1615
context:
1716
vf_embed_variant_4x3: true
18-
1917
- name: 16x9 and max-width
2018
context:
19+
isExample: true
2120
vf_embed_variant_16x9: true
2221
vf_embed_max_width: 480px
23-
2422
- name: custom
2523
context:
24+
isExample: true
2625
vf_embed_variant_custom: true
2726
vf_embed_custom_ratio_X: 7
2827
vf_embed_custom_ratio_Y: 2
29-
3028
- name: custom and max-width
3129
context:
30+
isExample: true
3231
vf_embed_max_width: 600px
3332
vf_embed_variant_custom: true
3433
vf_embed_custom_ratio_X: 11

components/vf-table/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
[![npm version](https://badge.fury.io/js/%40visual-framework%2Fvf-table.svg)](https://badge.fury.io/js/%40visual-framework%2Fvf-table)
44

5+
## About
6+
7+
Ever useful for presentation of tabular information and data — never to be used for layout.
8+
59
## Usage
610

711
### CSS Class Reference
@@ -13,7 +17,6 @@
1317
| `vf-table--bordered` | `vf-table` | adds a border around all elements |
1418
| `vf-table--compact` | `vf-table` | Reduces the padding on the heading and cells |
1519
| `vf-table--loose` | `vf-table` | Increases the padding on the heading and cells |
16-
| | | |
1720

1821
## Install
1922

components/vf-table/vf-table.config.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,52 @@
22
title: Table
33
# Label shown on index pages
44
label: Table
5-
status: alpha
5+
status: beta
66

77
variants:
88
- name: default
99

1010
- name: has footer
1111
context:
12+
isExample: true
1213
table_footer:
1314
- text: Hello
1415
colspans: 3
1516
- text: world
1617
colspans: 1
1718
- name: has caption
1819
context:
20+
isExample: true
1921
table_caption: Hello Caption
2022
- name: has row heading
2123
context:
24+
isExample: true
2225
firstCellIsHeader: true
2326
- name: actions
2427
context:
28+
isExample: true
2529
inline_actions:
2630
- edit
2731
- delete
2832
- name: sortable
2933
context:
34+
isExample: true
3035
sortable: true
3136
- name: selectable
3237
context:
38+
isExample: true
3339
selectable: true
3440
- name: selectable (selected)
3541
context:
42+
isExample: true
3643
selected: true
3744
selectable: true
3845
actions:
3946
- edit
4047
- delete
4148
- download
4249
- cancel
43-
44-
45-
50+
# Deprecated variants
4651
- name: striped
4752
hidden: true
4853
status: deprecated
@@ -95,16 +100,14 @@ variants:
95100

96101
context:
97102
component-type: block
98-
103+
exampleMultiColumns: "false"
99104
count: 0
100-
101105
table_headings:
102106
- title: Event
103107
- title: Date
104108
sorted: top
105109
- title: Type
106110
- title: Location
107-
108111
table_rows:
109112
-
110113
- selected_row: true

tools/vf-component-generator/templates/_component.config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ status: alpha
1111
# label: Default
1212
# hidden: true
1313
# context:
14+
# isExample: true # if this only demonstrates usage
1415
# children_are_possible:
1516
# variant_title: A Easy Card Title 1
1617
# variant_href: "JavaScript:Void(0);"
@@ -19,8 +20,9 @@ status: alpha
1920
# Global component context
2021
context:
2122
component-type: <%= componentType %>
23+
exampleMultiColumns: "true" # shows component previews in a smaller layout space (must be wrapped in "quotes")
2224
# custom-values: passed as {{custom-values}}
23-
# - note: you in your custom-values you should use dashes `-`
25+
# - note: you in your custom-values you should use dashes `-`
2426
# and not underscores `_` as underscores prevent inherited template use
2527
# title: Title text
2628
# text: String of text

tools/vf-component-library/src/site/_includes/layouts/base.njk

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292
<a href="{{ siteConfig.sections[section].url | url }}" class="vf-breadcrumbs__link">{{ siteConfig.sections[section].title }}</a>
9393
</li>
9494
{% endif %}
95+
{# Components #}
96+
{% if pagination.items[0] %}
97+
<li class="vf-breadcrumbs__item">
98+
<a href="/components" class="vf-breadcrumbs__link">Components and patterns</a>
99+
</li>
100+
{% endif %}
95101
{# Handle child components #}
96102
{% if pagination.items[0] %}
97103
{% if pagination.items[0].name.split('__')[1] %}

0 commit comments

Comments
 (0)