From c85ac3110de1e15dcb124d02a28f408fab5e4b44 Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Fri, 8 May 2020 20:15:46 -0600 Subject: [PATCH] feat: update sys-form to use display: grid by default --- src/components/sys-form-error.vue | 1 + src/components/sys-form-input.vue | 8 -------- src/components/sys-form-markdown.vue | 5 ----- src/components/sys-form-select.vue | 9 +-------- src/components/sys-form-textarea.vue | 8 -------- src/components/sys-form.stories.mdx | 17 +++++++++++++++++ src/components/sys-form.vue | 10 ++++++++-- 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/components/sys-form-error.vue b/src/components/sys-form-error.vue index b950a3b..7f8f18f 100644 --- a/src/components/sys-form-error.vue +++ b/src/components/sys-form-error.vue @@ -22,6 +22,7 @@ border: 1px solid var(--color-light-form-input-border); color: var(--color-light-form-input-background); display: block; + grid-column: 1 / -1; padding: 0.5rem; } diff --git a/src/components/sys-form-input.vue b/src/components/sys-form-input.vue index bf9e0ff..756e9f6 100644 --- a/src/components/sys-form-input.vue +++ b/src/components/sys-form-input.vue @@ -8,7 +8,6 @@ - - diff --git a/src/components/sys-form-markdown.vue b/src/components/sys-form-markdown.vue index 271e71e..65f79c2 100644 --- a/src/components/sys-form-markdown.vue +++ b/src/components/sys-form-markdown.vue @@ -181,11 +181,6 @@ diff --git a/src/components/sys-form-textarea.vue b/src/components/sys-form-textarea.vue index 0f42b54..1eb28a0 100644 --- a/src/components/sys-form-textarea.vue +++ b/src/components/sys-form-textarea.vue @@ -8,7 +8,6 @@ - - diff --git a/src/components/sys-form.stories.mdx b/src/components/sys-form.stories.mdx index 36c8bd6..96c7760 100644 --- a/src/components/sys-form.stories.mdx +++ b/src/components/sys-form.stories.mdx @@ -18,6 +18,23 @@ please take a look at the example storybooks. +## Styling + +By default, the form element is `display: grid`. This allows you to build some +fancy multi line forms while avoiding a bunch of the messy margin properties. + +For this to work, if you are putting inputs next to each other, you need to +explicit set the grid columns like so: + +```css +form { + grid-template-columns: repeat(3, 1fr); +} +``` + +If you do not do this, the bottom action buttons will not span to the end and +look off. + ### Normal This is how a basic form would look. diff --git a/src/components/sys-form.vue b/src/components/sys-form.vue index ee5d9f0..1654b9f 100644 --- a/src/components/sys-form.vue +++ b/src/components/sys-form.vue @@ -161,7 +161,12 @@