Skip to content

Commit

Permalink
Add date form component
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed Nov 23, 2022
1 parent c1202a8 commit 656a94e
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 9 deletions.
22 changes: 22 additions & 0 deletions src-site/components/date-picker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Date Picker
---

A Date Picker is a form used for inputting dates, such as when creating an election in Every Election.

<div class="ds-scope site-resizer">
<div class="ds-date">
<div class="ds-field">
<label for="day_0">Day</label>
<input type="number" name="day_0" value="12" required="" id="id_date-date_0">
</div>
<div class="ds-field">
<label for="month_1">Month</label>
<input type="number" name="month_1" value="12" required="" id="id_date-date_1">
</div>
<div class="ds-field">
<label for="year_2">Year</label>
<input type="number" name="year_2" value="2025" required="" id="id_date-date_2">
</div>
</div>
</div>
22 changes: 18 additions & 4 deletions src-site/usage/composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,22 @@ By combining [Stacks]({{site.basedir}}/components/stack), [Grids]({{site.basedir
<div class="ds-field">
<button class="ds-button" type="submit">Log in</button>
</div>
</form>
</div>
</form>
<div>
<div class="ds-date">
<div class="ds-field">
<label for="day_0">Day</label>
<input type="number" name="day_0" value="12" required="" id="id_date-date_0">
</div>
<div class="ds-field">
<label for="month_1">Month</label>
<input type="number" name="month_1" value="12" required="" id="id_date-date_1">
</div>
<div class="ds-field">
<label for="year_2">Year</label>
<input type="number" name="year_2" value="2025" required="" id="id_date-date_2">
</div>
</div>
</div>
</div>
</div>

</div>
9 changes: 8 additions & 1 deletion src-site/usage/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ Although the design system—even including _all_ of the components—is relativ

Follow the HTML examples in individual components docs. If you are making a page layout from scratch, see [Page layout]({{site.basedir}}/usage/page-layout).

## Adding or changing components

Update or create a partial file containing the component style such as `system/partials/_date-picker.scss`.


If a new component is added:
1. Create a src-site/components/new-component.md file to explain it's use with an html example.
2. Add the html example to `src-site/usage/composition.md` to be sure it's included in Lighthouse tests.
3. Add the partial to system/docs.scss (twice, import the `mixin` at the top, then add it to `optional-styles`)
4. Run `npm run watch:eleventy` to view changes to source site.
5. Once changes are complete, update the version in `package.json` and lock it with `npm install`
8 changes: 7 additions & 1 deletion system/docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
@import 'partials/_page.scss';
@import 'partials/_party.scss';
@import 'partials/_utilities.scss';
@import 'partials/_date-picker.scss';
@import 'partials/_switcher.scss';
@import 'partials/_showcase.scss';

// Generate atomic classes for documentation demos
@import 'partials/_classes-colors.scss';
Expand Down Expand Up @@ -62,7 +65,10 @@ $scope: true;
@include filter;
@include status;
@include codeblock;
@include party
@include party;
@include date-picker;
@include switcher;
@include showcase;
}

@if $scope {
Expand Down
10 changes: 7 additions & 3 deletions system/partials/_cluster.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
%ds-cluster > *,
%ds-cluster-right > *,
%ds-cluster-center > * {
%ds-cluster-element {
padding-left: 0;
list-style: none;
display: flex;
Expand All @@ -10,6 +8,12 @@
margin: calc(#{$ss5} * -1);
}

%ds-cluster > *,
%ds-cluster-right > *,
%ds-cluster-center > * {
@extend %ds-cluster-element
}

%ds-cluster > * > *,
%ds-cluster-right > * > *,
%ds-cluster-center > * > * {
Expand Down
17 changes: 17 additions & 0 deletions system/partials/_date-picker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@mixin date-picker {
.ds-date {
@extend %ds-cluster-element;
.ds-field {
input {
margin: 10px 15px 5px 0;
border: 2px solid $black;
padding: $s1;
max-width: 5em;
color:$black;
}
&:last-child input {
max-width: 6em;
}
}
}
}

0 comments on commit 656a94e

Please sign in to comment.