Skip to content

Commit

Permalink
Progress on 'section', and 'forms'.
Browse files Browse the repository at this point in the history
  • Loading branch information
elycruz committed Sep 25, 2022
1 parent b17ba9d commit e4bf1c7
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 37 deletions.
3 changes: 3 additions & 0 deletions src/css/base/copy.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1, h2, h3, h4, h5, h6 {
margin: 0;
}
2 changes: 2 additions & 0 deletions src/css/base/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "copy.css";

html, body {
--x-font-family: Arial, Verdana, Helvetica, Sans-Serif;

Expand Down
5 changes: 0 additions & 5 deletions src/css/index.stories.css
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
@import url(./index.css);

header + article {
margin-top: 1rem;
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
label {
user-select: none;
}

label:has(+ *) {
font-weight: bold;
}

label:has(+ :required, + * :required)::before {
content: "*";
color: red;
margin-right: 0.25rem;
}

/*
* x-field
Expand All @@ -21,14 +34,11 @@
}

:is(x-field, .x-field) :is(.x-help, [slot="help"]) {
margin-top: 0.5rem;
font-size: smaller;
}

:is(x-field, .x-field) .x-error-message {
color: red;
margin-top: 0.5rem;
}

:is(.x-fieldset, fieldset):not(.x-layout-vertical) :is(x-field, .x-field) > :is(x-field, x-field) {
margin: 0 0 1rem 1rem;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
legend {
font-weight: bold;
font-size: 18px;
}

/* ----------------
* x-fieldset
* ---------------- */
:is(fieldset, .x-fieldset) {
padding: 1rem;
}

:is(fieldset, .x-fieldset) + :is(fieldset,.x-fieldset) {
margin-top: 1rem;
:is(fieldset, .x-fieldset) + :is(fieldset, .x-fieldset) {
margin-top: 1.5rem;
}

.x-layout-horizontal > x-field + x-field {
Expand Down Expand Up @@ -36,10 +41,18 @@
}

:is(.x-fieldset, fieldset):not(.x-grid):not(.x-layout-horizontal)
> :is(x-field, .x-field) {
> :is(x-field, .x-field):not(:last-child) {
margin-bottom: 1rem;
}

:is(.x-fieldset, fieldset):not(.x-grid) > * + :is(x-field, .x-field, label) {
margin-left: 1rem;
}

:is(.x-fieldset, fieldset):not(.x-layout-vertical) :is(x-field, .x-field) > :is(x-field, x-field) {
margin: 0 0 1rem 1rem;
}

:is(.x-fieldset, fieldset) > :is(* + button, button + *) {
margin-left: 0.5rem;
}
3 changes: 3 additions & 0 deletions src/css/modules/forms/form.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:is(.x-form, form):not(.x-layout-horizontal) + form {
margin-top: 1.5rem;
}
6 changes: 3 additions & 3 deletions src/css/modules/forms/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import url(label.css);
@import url(x-field.css);
@import url(x-fieldset.css);
@import url(form.css);
@import url(field.css);
@import url(fieldset.css);
10 changes: 2 additions & 8 deletions src/css/modules/forms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
<link rel="stylesheet" href="../../index.stories.css" />
</head>
<body>
<section>
<div class="x-field">
<label for="input">Default</label>
<input name="input" id="input"/>
</div>
</section>
<section>
<header>
<h2>X-Field</h2>
Expand Down Expand Up @@ -87,8 +81,8 @@ <h2>X-Field</h2>
</fieldset>

<fieldset>
<button class="x-field" type="reset">Reset</button>
<button class="x-field">Submit</button>
<button type="reset">Reset</button>
<button>Submit</button>
</fieldset>
</form>
<form action="#">
Expand Down
13 changes: 0 additions & 13 deletions src/css/modules/forms/label.css

This file was deleted.

10 changes: 9 additions & 1 deletion src/css/modules/section.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
section :is(header + *, > div > header + *) {
section > :is(header, div > header) {
padding: 1.5rem;
}

section > :is(section, div > section, article, div > article) {
border-top: var(--x-1px) solid var(--x-neutral-hsl-4);
}

section article {
padding: 1rem;
}

0 comments on commit e4bf1c7

Please sign in to comment.