Skip to content
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

Redesign the Handlebars demo app (Web, React, Form Validations) #DS-1479 #1666

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
1 change: 1 addition & 0 deletions apps/demo/config/vite/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default defineConfig({
},
runtimeOptions: {
data: {
is_development: process.env.NODE_ENV === 'development',
// Get the list of components directories and pass their names to the data
web_components: getListOfNestedDirectories('../../packages/web/src/scss/components', 'index.html'),
// Get the list of helpers directories and pass their names to the data
Expand Down
5 changes: 0 additions & 5 deletions apps/demo/partials/boxList.hbs

This file was deleted.

5 changes: 5 additions & 0 deletions apps/demo/partials/card.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<li class="d-grid">
<a href="{{path}}/{{urlname}}/" class="docs-Card text-truncate">
{{content}}
</a>
</li>
5 changes: 5 additions & 0 deletions apps/demo/partials/cardList.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ul class="Grid Grid--cols-2 Grid--tablet--cols-3">

{{> @partial-block}}

</ul>
3 changes: 0 additions & 3 deletions apps/demo/partials/component.hbs

This file was deleted.

50 changes: 50 additions & 0 deletions apps/demo/partials/cover.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="spirit-theme-light-on-brand bg-primary mb-tablet-1200 py-1200 py-tablet-1700">
<div class="Container">

<h1
class="Flex Flex--noWrap Flex--alignmentXStretch Flex--alignmentYCenter Flex--row typography-heading-xlarge-bold"
style="--flex-spacing: var(--spirit-space-1000)"
>
{{title}}

{{#if isUnstable}}
<span class="Tag Tag--large Tag--warning">Unstable</span>
{{/if}}
</h1>

<nav aria-label="Breadcrumbs" class="Breadcrumbs">
<ol>
<li class="d-flex">
<a href="/" class="link-primary link-underlined">Spirit</a>
<svg width="24" height="24" aria-hidden="true">
<use xlink:href="/assets/icons/svg/sprite.svg#chevron-right" />
</svg>
</li>
{{#if package}}
<li class="d-flex">
<a href="{{packageUrl}}" class="link-primary link-underlined">{{package}}</a>
<svg width="24" height="24" aria-hidden="true">
<use xlink:href="/assets/icons/svg/sprite.svg#chevron-right" />
</svg>
</li>
{{/if}}
{{#if parentPageName}}
<li class="d-flex">
<a href="{{#if (eq parentPageName 'Components') }}{{packageUrl}}{{else}}..{{/if}}" class="link-primary link-underlined">
{{parentPageName}}
</a>
<svg width="24" height="24" aria-hidden="true">
<use xlink:href="/assets/icons/svg/sprite.svg#chevron-right" />
</svg>
</li>
{{/if}}
{{#if title}}
<li class="d-flex">
<a href="" aria-current="page" class="link-secondary">{{title}}</a>
</li>
{{/if}}
</ol>
</nav>

</div>
</div>
7 changes: 7 additions & 0 deletions apps/demo/partials/footer.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<footer class="bg-secondary mt-1200 mt-tablet-1700 pt-1400 pb-1200 text-center">
<div class="Container">

© Alma Career Oy and its subsidiaries

</div>
</footer>
16 changes: 16 additions & 0 deletions apps/demo/partials/form-validations/layout/default.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{#> layout/base package="Form Validations" packageUrl="/packages/form-validations/" title=title}}

{{> header}}
{{> cover}}

<main class="py-1000">
<div class="Container">

{{> @partial-block}}

</div>
</main>

{{> footer}}

{{/layout/base}}
146 changes: 131 additions & 15 deletions apps/demo/partials/header.hbs
Original file line number Diff line number Diff line change
@@ -1,20 +1,136 @@
<header class='spirit-theme-light-on-brand bg-primary text-secondary py-1200 py-tablet-1400'>
<div class='Container'>
<header class="Header spirit-theme-light-on-brand">
<a href="/" aria-label="Spirit Development Preview">
{{> web/assets/spiritLogoInverted }}
</a>

<h1 class='typography-heading-xlarge-bold'>Spirit Design System</h1>
<h2 class='typography-heading-medium-bold text-secondary mb-1000'>{{#if package}}{{package}} - {{/if}}Development Preview</h2>
<!-- HeaderMobileActions: start -->
<div class="HeaderMobileActions">
<button
type="button"
class="Button Button--secondary Button--medium Button--square"
data-spirit-toggle="offcanvas"
data-spirit-target="#off-canvas-navigation"
aria-controls="off-canvas-navigation"
aria-expanded="false"
>
<svg width="24" height="24" aria-hidden="true">
<use xlink:href="/assets/icons/svg/sprite.svg#hamburger" />
</svg>
<span class="accessibility-hidden">Menu</span>
</button>
</div>
<!-- HeaderMobileActions: end -->

<!-- HeaderDesktopActions: start -->
<nav class="HeaderDesktopActions" aria-label="Main navigation">
<!-- HeaderNav: start -->
<ul class="HeaderNav">
<li class="HeaderNavItem">
<a
href="/packages/web/"
class="HeaderLink {{# if (eq package 'Web')}}HeaderLink--current{{/if}}"
{{# if (eq package 'Web')}}aria-current="page"{{/if}}
>
Web
</a>
</li>
<li class="HeaderNavItem">
<a
href="/packages/web-react/"
class="HeaderLink {{# if (eq package 'Web React')}}HeaderLink--current{{/if}}"
{{# if (eq package 'Web React')}}aria-current="page"{{/if}}
>
Web React
</a>
</li>
{{!-- Hide link to the Twig implementation in production. Twig demo app only runs on localhost, we don't deploy it anywhere. --}}
{{#if @is_development}}
<li class="HeaderNavItem">
<a href="https://localhost:4443" class="HeaderLink">Web Twig</a>
</li>
{{/if}}
<li class="HeaderNavItem">
<a
href="/packages/form-validations/"
class="HeaderLink {{# if (eq package 'Form Validations')}}HeaderLink--current{{/if}}"
{{# if (eq package 'Form Validations')}}aria-current="page"{{/if}}
>
Form Validations
</a>
</li>
</ul>
<!-- HeaderNav: end -->
</nav>
<!-- HeaderDesktopActions: end -->

</header>

<!-- HeaderDialog: start -->
<dialog id="off-canvas-navigation" class="HeaderDialog" aria-label="Menu">
<div class="HeaderDialog__panel">
<div class="HeaderDialog__content">

<div class='d-grid d-tablet-block'>
<a
href='https://github.com/lmc-eu/spirit-design-system'
class='Button Button--tertiary Button--large mb-400 mb-tablet-0 mr-tablet-400'
<!-- HeaderDialogCloseButton: start -->
<button
type="button"
class="HeaderDialogCloseButton"
data-spirit-dismiss="off-canvas-navigation"
data-spirit-target="#off-canvas-navigation"
aria-controls="off-canvas-navigation"
aria-expanded="false"
>
GitHub Project
</a>
<a href='https://spirit.supernova-docs.io/spirit/' class='Button Button--tertiary Button--large'>
Spirit Docs →
</a>
</div>
<svg width="24" height="24" aria-hidden="true">
<use xlink:href="/assets/icons/svg/sprite.svg#close" />
</svg>
<span class="accessibility-hidden">Close</span>
</button>
<!-- HeaderDialogCloseButton: end -->

<!-- HeaderDialogActions: start -->
<nav class="HeaderDialogActions HeaderDialogActions--primary" aria-label="Main navigation">

<!-- HeaderDialogNav: start -->
<ul class="HeaderDialogNav">
<li class="HeaderDialogNavItem">
<a
href="/packages/web/"
class="HeaderDialogLink {{# if (eq package 'Web')}}HeaderDialogLink--current{{/if}}"
{{# if (eq package 'Web')}}aria-current="page"{{/if}}
>
Web
</a>
</li>
<li class="HeaderDialogNavItem">
<a
href="/packages/web-react/"
class="HeaderDialogLink {{# if (eq package 'Web React')}}HeaderDialogLink--current{{/if}}"
{{# if (eq package 'Web React')}}aria-current="page"{{/if}}
>
Web React
</a>
</li>
{{!-- Hide link to the Twig implementation in production. Twig demo app only runs on localhost, we don't deploy it anywhere. --}}
{{#if @is_development}}
<li class="HeaderDialogNavItem">
<a href="https://localhost:4443" class="HeaderDialogLink">Web Twig</a>
</li>
adamkudrna marked this conversation as resolved.
Show resolved Hide resolved
{{/if}}
<li class="HeaderDialogNavItem">
<a
href="/packages/form-validations/"
class="HeaderDialogLink {{# if (eq package 'Form Validations')}}HeaderDialogLink--current{{/if}}"
{{# if (eq package 'Form Validations')}}aria-current="page"{{/if}}
>
Form Validations
</a>
</li>
</ul>
<!-- HeaderDialogNav: end -->

</nav>
<!-- HeaderDialogActions: end -->

</div>
</div>
</header>
</dialog>
<!-- HeaderDialog: end -->
14 changes: 12 additions & 2 deletions apps/demo/partials/layout/base.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>{{#if package}}{{package}} - {{/if}}Development Preview</title>
<title>
{{#if title}}
{{title}} —
{{#if package}}{{package}} —{{/if}}
Spirit Design System
{{else}}
Spirit Design System — Development preview
{{/if}}
</title>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Expand All @@ -19,11 +27,13 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=block">
<link rel="stylesheet" href="/apps/demo/assets/index.scss">

<script src="/packages/web/src/js/index.esm.ts" type="module"></script>

{{#> scripts}}
{{/scripts}}

</head>
<body>
<body class="bg-primary">

{{> @partial-block}}

Expand Down
20 changes: 0 additions & 20 deletions apps/demo/partials/layout/default.hbs

This file was deleted.

11 changes: 0 additions & 11 deletions apps/demo/partials/layout/plain.hbs

This file was deleted.

7 changes: 0 additions & 7 deletions apps/demo/partials/section.hbs

This file was deleted.

5 changes: 0 additions & 5 deletions apps/demo/partials/tileList.hbs

This file was deleted.

8 changes: 4 additions & 4 deletions apps/demo/partials/web-react/demo.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#> web-react/layout/plain }}
{{#> web-react/layout/default }}

<div id="root"></div>
<script type="module" src="./demo/index.tsx"></script>
<div id="root"></div>
<script type="module" src="./demo/index.tsx"></script>

{{/web-react/layout/plain }}
{{/web-react/layout/default }}
10 changes: 4 additions & 6 deletions apps/demo/partials/web-react/icons.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{{#> web-react/layout/default page="icons"}}
{{#> web-react/layout/default page="icons" title="Icons"}}

{{#> section title="Icons"}}
{{> web-react/tabs }}

<div id="root"></div>
<script type="module" src="./index.tsx"></script>

{{/section}}
<div id="root"></div>
<script type="module" src="./index.tsx"></script>

{{/web-react/layout/default}}
16 changes: 8 additions & 8 deletions apps/demo/partials/web-react/index.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{#> web-react/layout/default page="components"}}
{{#> web-react/layout/default page="components" title="Components"}}

{{#> section title="Components"}}
{{#> boxList}}
{{#each @web_react_components as |component|}}
{{> component component=component path="src/components"}}
{{/each}}
{{/boxList}}
{{/section}}
{{> web-react/tabs }}

{{#> cardList}}
{{#each @web_react_components as |component|}}
{{> card content=component.title path="src/components" urlname=component.name}}
{{/each}}
{{/cardList}}

{{/web-react/layout/default}}
Loading
Loading