Skip to content

refactor: icons documentation display #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 61 additions & 5 deletions source/_patterns/icons/_icons.demonstration.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DO-NOT-COPY-THIS-CLASS-example-icon-list {
&,
ul {
ol {
list-style: none;

padding-left: 0;
Expand All @@ -16,18 +16,74 @@
min-width: 250px;
}
.DO-NOT-COPY-THIS-CLASS-example-bg-variants-regular {
ul {
ol {
justify-content: flex-end;
}
}
}

details {
summary {
cursor: pointer;

display: flex;
flex-direction: column;
align-items: center;

// Remove existing marker
&::-webkit-details-marker {
display: none;
}
// … and using some other declaration for Mozilla Firefox
&:first-of-type {
list-style-type: none;
}

figure {
text-align: center;
}
}

ul {
li {
display: list-item;
padding: initial;
}
}

// Icon details
aside {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 10;

background-color: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

padding: 1rem;
}

// Achieving a full viewport clickarea for closing the overflow menu
&[open] summary::after {
content: "\00A0";
display: inline-block;
height: 100vh;
left: 0;
position: fixed;
top: 0;
width: 100vw;
z-index: 5;
}
}

& > li {
display: flex;
}

&.icons {
ul {
&:where(.icons) {
ol {
color: $db-color-cool-gray-700;
}

Expand Down Expand Up @@ -74,7 +130,7 @@
}
}
&.functional {
ul {
ol {
display: flex;
align-items: center;
}
Expand Down
72 changes: 47 additions & 25 deletions source/_patterns/icons/functional/functional-icons.hbs
Original file line number Diff line number Diff line change
@@ -1,27 +1,49 @@
<ul class="DO-NOT-COPY-THIS-CLASS-example-icon-list icons functional">
{{#unless icons}}<p>Please keep in mind that it's optional to set the variant combination of size ({{ icon-size }}) and style ({{ icon-style }}) as these are defined as default.<br>In case that you'll need another default in your project, you could overwrite the defaults by overwriting the <code>$icon-size</code> and <code>$icon-style</code> SCSS variables.</p>{{/unless }}
<ol class="DO-NOT-COPY-THIS-CLASS-example-icon-list icons functional">
{{#each icons }}<li>
<ul>
{{#each @root.example-bgs }}
<li class="DO-NOT-COPY-THIS-CLASS-example-bg-variants-{{ variant }}">
<ul>
{{#each ../variants }}
{{#if_eq @root.category "transportation"}}
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="{{ size }}" height="{{ size }}" aria-hidden="true">
<use href="../../icons/functional/images/{{ @root.category }}/{{#if style}}{{style}}{{else}}regular{{/if }}/db_ic_{{ ../../icon }}{{#if style }}_{{ style }}{{/if }}_{{ size }}.svg#icon"></use>
</svg>
</li>
{{else}}
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="{{ size }}" height="{{ size }}" aria-hidden="true">
<use href="../../icons/functional/images/{{ @root.category }}/db_ic_{{ ../../icon }}{{#if style }}_{{ style }}{{/if }}_{{ size }}.svg#icon"></use>
</svg>
</li>
{{/if_eq}}
{{/each }}
</ul>
</li>
{{/each }}
</ul>
<details>
<summary>
<figure>
{{#if_eq @root.category "transportation"}}
<svg xmlns="http://www.w3.org/2000/svg" width="{{ @root.icon-size }}" height="{{ @root.icon-size }}" aria-hidden="true">
<use href="../../icons/functional/images/{{ @root.category }}/{{#if style}}{{style}}{{else}}regular{{/if }}/db_ic_{{ icon }}{{#if style }}_{{ style }}{{/if }}_20.svg#icon"></use>
</svg>
{{else}}
<svg xmlns="http://www.w3.org/2000/svg" width="{{ @root.icon-size }}" height="{{ @root.icon-size }}" aria-hidden="true">
<use href="../../icons/functional/images/{{ @root.category }}/db_ic_{{ icon }}{{#if style }}_{{ style }}{{/if }}_20.svg#icon"></use>
</svg>
{{/if_eq}}
<figcaption>{{ icon }}{{#if style }}_{{ style }}{{/if }}</figcaption>
</figure>
</summary>
<aside>
<ol>
{{#each @root.example-bgs }}
<li class="DO-NOT-COPY-THIS-CLASS-example-bg-variants-{{ variant }}">
<ol>
{{#each ../variants }}
{{#if_eq @root.category "transportation"}}
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="{{ size }}" height="{{ size }}" aria-hidden="true">
<use href="../../icons/functional/images/{{ @root.category }}/{{#if style}}{{style}}{{else}}regular{{/if }}/db_ic_{{ ../../icon }}{{#if style }}_{{ style }}{{/if }}_{{ size }}.svg#icon"></use>
</svg>
</li>
{{else}}
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="{{ size }}" height="{{ size }}" aria-hidden="true">
<use href="../../icons/functional/images/{{ @root.category }}/db_ic_{{ ../../icon }}{{#if style }}_{{ style }}{{/if }}_{{ size }}.svg#icon"></use>
</svg>
</li>
{{/if_eq}}
{{/each }}
</ol>
</li>
{{/each }}
</ol>
<ul>
<li>SCSS: <code>@include icon(glyph({{ icon }}))</code></li>
<li>HTML: <code>data-icon="{{ icon }}"</code></li>
</ul>
</aside>
</li>{{/each }}
</ul>
</ol>
4 changes: 3 additions & 1 deletion source/_patterns/icons/functional/functional-icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
{
"variant": "dark"
}
]
],
"icon-size": "24",
"icon-style": "outline"
}
30 changes: 21 additions & 9 deletions source/_patterns/icons/illustrative/illustrative-icons.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
<ul class="DO-NOT-COPY-THIS-CLASS-example-icon-list icons illustrative">
<ol class="DO-NOT-COPY-THIS-CLASS-example-icon-list icons illustrative">
{{#each icons }}<li>
<ul>
{{#each @root.example-bgs }}
<li class="DO-NOT-COPY-THIS-CLASS-example-bg-variants-{{ variant }}">
<details>
<summary>
<figure>
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" aria-hidden="true">
<use href="../../icons/illustrative/{{ @root.category }}/db_ic_il_{{ ../icon }}.svg#icon"></use>
<use href="../../icons/illustrative/{{ @root.category }}/db_ic_il_{{ icon }}.svg#icon"></use>
</svg>
</li>
{{/each }}
</ul>
<figcaption>{{ icon }}{{#if style }}_{{ style }}{{/if }}</figcaption>
</figure>
</summary>
<aside>
<ol>
{{#each @root.example-bgs }}
<li class="DO-NOT-COPY-THIS-CLASS-example-bg-variants-{{ variant }}">
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" aria-hidden="true">
<use href="../../icons/illustrative/{{ @root.category }}/db_ic_il_{{ ../icon }}.svg#icon"></use>
</svg>
</li>
{{/each }}
</ol>
</aside>
</details>
</li>{{/each }}
</ul>
</ol>