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

Fix svelte example components to not add css global #19410

Closed
wants to merge 6 commits into from
Closed
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
34 changes: 33 additions & 1 deletion code/lib/cli/rendererAssets/svelte/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import './button.css';
import { createEventDispatcher } from 'svelte';
/**
* Is this the principal call to action on the page?
Expand Down Expand Up @@ -41,3 +40,36 @@
>
{label}
</button>

<style>
.storybook-button {
benmccann marked this conversation as resolved.
Show resolved Hide resolved
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 700;
border: 0;
border-radius: 3em;
cursor: pointer;
display: inline-block;
line-height: 1;
}
.storybook-button--primary {
color: white;
background-color: #1ea7fd;
}
.storybook-button--secondary {
color: #333;
background-color: transparent;
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
}
.storybook-button--small {
font-size: 12px;
padding: 10px 16px;
}
.storybook-button--medium {
font-size: 14px;
padding: 11px 20px;
}
.storybook-button--large {
font-size: 16px;
padding: 12px 24px;
}
</style>
36 changes: 35 additions & 1 deletion code/lib/cli/rendererAssets/svelte/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import './header.css';
import Button from './Button.svelte';

import { createEventDispatcher } from 'svelte';
Expand Down Expand Up @@ -49,3 +48,38 @@
</div>
</div>
</header>

<style>
.wrapper {
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
padding: 15px 20px;
display: flex;
align-items: center;
justify-content: space-between;
}

svg {
display: inline-block;
vertical-align: top;
}

h1 {
font-weight: 900;
font-size: 20px;
line-height: 1;
margin: 6px 0 6px 10px;
display: inline-block;
vertical-align: top;
}

button + button {
margin-left: 10px;
}

.welcome {
color: #333;
font-size: 14px;
margin-right: 10px;
}
</style>
73 changes: 72 additions & 1 deletion code/lib/cli/rendererAssets/svelte/Page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import './page.css';
import Header from './Header.svelte';

let user = null;
Expand Down Expand Up @@ -61,3 +60,75 @@
</div>
</section>
</article>

<style>
section {
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 24px;
padding: 48px 20px;
margin: 0 auto;
max-width: 600px;
color: #333;
}

section h2 {
font-weight: 900;
font-size: 32px;
line-height: 1;
margin: 0 0 4px;
display: inline-block;
vertical-align: top;
}

section p {
margin: 1em 0;
}

section a {
text-decoration: none;
color: #1ea7fd;
}

section ul {
padding-left: 30px;
margin: 1em 0;
}

section li {
margin-bottom: 8px;
}

section .tip {
display: inline-block;
border-radius: 1em;
font-size: 11px;
line-height: 12px;
font-weight: 700;
background: #e7fdd8;
color: #66bf3c;
padding: 4px 12px;
margin-right: 10px;
vertical-align: top;
}

section .tip-wrapper {
font-size: 13px;
line-height: 20px;
margin-top: 40px;
margin-bottom: 40px;
}

section .tip-wrapper svg {
display: inline-block;
height: 12px;
width: 12px;
margin-right: 4px;
vertical-align: top;
margin-top: 3px;
}

section .tip-wrapper svg path {
fill: #1ea7fd;
}
</style>