Skip to content

Commit

Permalink
Merge pull request #2453 from boltdesignsystem/feature/ds-737-two-col…
Browse files Browse the repository at this point in the history
…umn-form-layout

DS-737 multi-column form layout and grid spacing fix
  • Loading branch information
colbytcook committed Mar 28, 2022
2 parents 55b87fd + 96a9e7c commit 441bc4d
Show file tree
Hide file tree
Showing 14 changed files with 782 additions and 100 deletions.
2 changes: 1 addition & 1 deletion docs-site/.incache

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
{% set description %}
Use the grid to create multi-column form layouts.
{% endset %}

{% set demo %}
{% set icon_external_link %}
{% include '@bolt-elements-icon/icon.twig' with {
name: 'external-link',
} only %}
{% endset %}
{% include '@bolt-elements-text-link/text-link.twig' with {
content: 'View full page demo',
icon_after: icon_external_link,
attributes: {
href: link['components-form-demo-multiple-columns'],
target: '_blank',
rel: 'noopener'
}
} only %}
{% endset %}

{% set twig_markup %}{% verbatim %}
{% set form_children %}
{% set category_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Category',
displayType: 'floating',
attributes: {
for: 'category',
},
} only %}
{% endset %}
{% set select %}
{% include '@bolt-components-form/form-select.twig' with {
options: [
{
type: 'option',
value: '',
label: '- Select a category -',
},
{
type: 'option',
value: 'option-a',
label: 'Option A'
},
{
type: 'option',
value: 'option-b',
label: 'Option B'
}
],
attributes: {
id: 'category',
required: true,
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: select,
} only %}
{% endset %}
{% set first_name_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'First name',
displayType: 'floating',
attributes: {
for: 'first-name',
},
} only %}
{% endset %}
{% set input %}
{% include '@bolt-components-form/form-input.twig' with {
attributes: {
placeholder: 'Enter first name',
type: 'text',
id: 'first-name',
required: true,
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: input,
} only %}
{% endset %}
{% set last_name_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Last name',
displayType: 'floating',
attributes: {
for: 'last-name',
},
} only %}
{% endset %}
{% set input %}
{% include '@bolt-components-form/form-input.twig' with {
attributes: {
placeholder: 'Enter last name',
type: 'text',
id: 'last-name',
required: true,
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: input,
} only %}
{% endset %}
{% set work_email_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Work email',
displayType: 'floating',
attributes: {
for: 'work-email',
},
} only %}
{% endset %}
{% set input %}
{% include '@bolt-components-form/form-input.twig' with {
attributes: {
placeholder: 'Enter work email',
type: 'email',
id: 'work-email',
required: true,
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: input,
} only %}
{% endset %}
{% set phone_number_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Phone number',
displayType: 'floating',
attributes: {
for: 'phone-number',
},
} only %}
{% endset %}
{% set input %}
{% include '@bolt-components-form/form-input.twig' with {
attributes: {
placeholder: 'Enter phone number',
type: 'tel',
id: 'phone-number',
required: true,
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: input,
} only %}
{% endset %}
{% set country_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Country',
displayType: 'floating',
attributes: {
for: 'country',
},
} only %}
{% endset %}
{% set select %}
{% include '@bolt-components-form/form-select.twig' with {
options: [
{
type: 'option',
value: '',
label: '- Select a country -',
},
{
type: 'option',
value: 'option-a',
label: 'Option A'
},
{
type: 'option',
value: 'option-b',
label: 'Option B'
}
],
attributes: {
id: 'country',
required: true,
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: select,
} only %}
{% endset %}
{% set message_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Message',
displayType: 'floating',
attributes: {
for: 'message',
},
} only %}
{% endset %}
{% set textarea %}
{% include '@bolt-components-form/form-textarea.twig' with {
attributes: {
placeholder: 'Enter a message',
rows: 5,
required: true,
id: 'message',
}
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: textarea,
} only %}
{% endset %}
{% set agreement_input %}
{% set label %}
{% include '@bolt-components-form/form-label.twig' with {
title: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
displayType: 'inline-checkbox',
attributes: {
for: 'agreement',
name: 'agreement',
},
} only %}
{% endset %}
{% set input %}
{% include '@bolt-components-form/form-input.twig' with {
attributes: {
type: 'checkbox',
id: 'agreement',
},
} only %}
{% endset %}
{% include '@bolt-components-form/form-element.twig' with {
label: label,
children: input,
} only %}
{% endset %}
{% set submit_button %}
{% include '@bolt-elements-button/button.twig' with {
content: 'Send',
display: 'block',
attributes: {
type: 'submit'
},
} only %}
{% endset %}


{% include '@bolt-components-grid/grid.twig' with {
items: [
{
column_start: '1',
column_span: '12',
content: category_input,
},
{
column_start: '1',
column_span: '12 6@small',
content: first_name_input,
},
{
column_start: '1 7@small',
column_span: '12 6@small',
content: last_name_input,
},
{
column_start: '1',
column_span: '12 6@small',
content: work_email_input,
},
{
column_start: '1 7@small',
column_span: '12 6@small',
content: phone_number_input,
},
{
column_start: '1',
column_span: '12',
content: country_input,
},
{
column_start: '1',
column_span: '12',
content: message_input,
},
{
column_start: '1',
column_span: '12',
content: agreement_input,
},
{
column_start: '1',
column_span: '12',
content: submit_button,
},
]
} only %}
{% endset %}

{% include '@bolt-components-form/form.twig' with {
children: form_children,
} only %}
{% endverbatim %}{% endset %}

{% include '@utils/pattern-doc-page.twig' with {
title: 'Use Case: Multiple Columns',
description: description,
demo: demo,
twig_markup: twig_markup,
} only %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: "Demo: Multi-column Form"
---
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% set schema = bolt.data.components['@bolt-components-grid'].schema %}

{% set schema = bolt.data.components['@bolt-components-grid'].schema['grid'] %}
{% set gutters = schema.properties.gutter.enum %}

{% set placeholder %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% set schema = bolt.data.components['@bolt-components-grid'].schema %}

{% set schema = bolt.data.components['@bolt-components-grid'].schema['grid'] %}
{% set row_gutters = schema.properties.row_gutter.enum %}

{% set placeholder %}
Expand Down
15 changes: 4 additions & 11 deletions packages/components/bolt-grid/grid-item.schema.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
module.exports = {
$schema: 'http://json-schema.org/draft-04/schema#',
title: 'Bolt Grid Item',
description:
'THIS WILL BE DEPRECATED. MUST REMOVE A REFERENCE OF THIS IN THE BAND SCHEMA (which would be fixed with the band refactor work).',
title: 'Grid Item',
description: 'Grid item within a 12-column grid.',
type: 'object',
properties: {
attributes: {
type: 'object',
description:
'A Drupal-style attributes object with extra attributes to append to this component.',
},
align: {
type: 'string',
description: 'Horizontal alignment of the grid item itself',
default: 'start',
enum: ['start', 'center', 'end'],
},
valign: {
type: 'string',
description: 'Vertical alignment of the grid item itself',
default: 'start',
enum: ['start', 'center', 'end'],
enum: ['auto', 'start', 'center', 'end'],
default: 'auto',
},
column_start: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-grid/grid.schema.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
$schema: 'http://json-schema.org/draft-04/schema#',
title: 'Bolt Grid',
title: 'Grid',
description: 'A flexible 12-column grid with responsive breakpoint options.',
type: 'object',
properties: {
Expand Down
5 changes: 4 additions & 1 deletion packages/components/bolt-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"access": "public"
},
"gitHead": "d41aa75ae3d195d9d7fb3952eed5e0ae80988133",
"schema": "grid.schema.js"
"schema": [
"grid.schema.js",
"grid-item.schema.js"
]
}

0 comments on commit 441bc4d

Please sign in to comment.