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

Add nunito sans font #20846

Merged
merged 5 commits into from
Feb 2, 2023
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
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/template/cli/js/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import StackAlt from './assets/stackalt.svg';
{`
.subheading {
--mediumdark: '#999999';
font-weight: 900;
font-weight: 700;
font-size: 13px;
color: #999;
letter-spacing: 6px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import StackAlt from './assets/stackalt.svg';
{`
.subheading {
--mediumdark: '#999999';
font-weight: 900;
font-weight: 700;
font-size: 13px;
color: #999;
letter-spacing: 6px;
Expand Down
16 changes: 10 additions & 6 deletions code/lib/builder-manager/templates/template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />

<% if (favicon.endsWith('.svg')) {%>
<link rel="icon" type="image/svg+xml" href="./<%= favicon %>">
<link rel="icon" type="image/svg+xml" href="./<%= favicon %>" />
<% } else if (favicon.endsWith('.ico')) { %>
<link rel="icon" type="image/x-icon" href="./<%= favicon %>">
<link rel="icon" type="image/x-icon" href="./<%= favicon %>" />
<% } %>

<link rel="preload" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />

<% if (typeof head !== 'undefined') { %> <%- head %> <% } %>

<style>
#storybook-root[hidden]{
#storybook-root[hidden] {
display: none !important;
}
</style>
Expand All @@ -42,9 +46,9 @@

<% files.js.forEach(file => { %>
import '<%= file %>';
<% }); %>
</script>
<% }); %>
</script>

<link href="./sb-preview/runtime.mjs" rel="preload" as="script">
<link href="./sb-preview/runtime.mjs" rel="preload" as="script" />
</body>
</html>
66 changes: 38 additions & 28 deletions code/lib/builder-vite/input/iframe.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
<!DOCTYPE html>
<!--suppress HtmlUnknownTarget -->
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Storybook</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script>
window.CONFIG_TYPE = '[CONFIG_TYPE HERE]';
window.LOGLEVEL = '[LOGLEVEL HERE]';
window.FRAMEWORK_OPTIONS = '[FRAMEWORK_OPTIONS HERE]';
window.CHANNEL_OPTIONS = '[CHANNEL_OPTIONS HERE]';
window.FEATURES = '[FEATURES HERE]';
window.STORIES = '[STORIES HERE]';
window.DOCS_OPTIONS = '[DOCS_OPTIONS HERE]';
window.SERVER_CHANNEL_URL = '[SERVER_CHANNEL_URL HERE]';

// We do this so that "module && module.hot" etc. in Storybook source code
// doesn't fail (it will simply be disabled)
window.module = undefined;
</script>
<!-- [HEAD HTML SNIPPET HERE] -->
</head>
<body>
<!-- [BODY HTML SNIPPET HERE] -->
<div id="storybook-root"></div>
<div id="storybook-docs"></div>
<script type="module" src="./sb-preview/runtime.mjs"></script>
<script type="module" src="/virtual:/@storybook/builder-vite/vite-app.js"></script>
</body>
</html>

<head>
<meta charset="utf-8" />
<title>Storybook</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="preload" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-bold-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />

<script>
window.CONFIG_TYPE = '[CONFIG_TYPE HERE]';
window.LOGLEVEL = '[LOGLEVEL HERE]';
window.FRAMEWORK_OPTIONS = '[FRAMEWORK_OPTIONS HERE]';
window.CHANNEL_OPTIONS = '[CHANNEL_OPTIONS HERE]';
window.FEATURES = '[FEATURES HERE]';
window.STORIES = '[STORIES HERE]';
window.DOCS_OPTIONS = '[DOCS_OPTIONS HERE]';
window.SERVER_CHANNEL_URL = '[SERVER_CHANNEL_URL HERE]';

// We do this so that "module && module.hot" etc. in Storybook source code
// doesn't fail (it will simply be disabled)
window.module = undefined;
</script>
<!-- [HEAD HTML SNIPPET HERE] -->
</head>

<body>
<!-- [BODY HTML SNIPPET HERE] -->
<div id="storybook-root"></div>
<div id="storybook-docs"></div>
<script type="module" src="./sb-preview/runtime.mjs"></script>
<script type="module" src="/virtual:/@storybook/builder-vite/vite-app.js"></script>
</body>

</html>
6 changes: 6 additions & 0 deletions code/lib/builder-webpack5/templates/preview.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="preload" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./sb-common-assets/nunito-sans-bold-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />

<% if (typeof headHtmlSnippet !== 'undefined') { %> <%= headHtmlSnippet %> <% } %> <%
htmlWebpackPlugin.files.css.forEach(file => { %>
<link href="<%= file %>" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/rendererAssets/common/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import StackAlt from './assets/stackalt.svg';
{`
.subheading {
--mediumdark: '#999999';
font-weight: 900;
font-weight: 700;
font-size: 13px;
color: #999;
letter-spacing: 6px;
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/rendererAssets/common/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ svg {
}

h1 {
font-weight: 900;
font-weight: 700;
font-size: 20px;
line-height: 1;
margin: 6px 0 6px 10px;
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/rendererAssets/common/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ section {
}

section h2 {
font-weight: 900;
font-weight: 700;
font-size: 32px;
line-height: 1;
margin: 0 0 4px;
Expand Down
19 changes: 14 additions & 5 deletions code/lib/core-server/src/presets/common-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,41 @@ import type {
CoreConfig,
Options,
StorybookConfig,
PresetPropertyFn,
} from '@storybook/types';
import { loadCsf } from '@storybook/csf-tools';
import { join } from 'path';
import { dirname, join } from 'path';
import { dedent } from 'ts-dedent';
import { parseStaticDir } from '../utils/server-statics';

const defaultFavicon = require.resolve('@storybook/core-server/public/favicon.svg');

export const staticDirs: PresetPropertyFn<'staticDirs'> = async (values = []) => [
ndelangen marked this conversation as resolved.
Show resolved Hide resolved
{
from: join(dirname(require.resolve('@storybook/manager/package.json')), 'static'),
to: '/sb-manager-assets',
},
...values,
];

export const favicon = async (
value: string,
options: Pick<Options, 'presets' | 'configDir' | 'staticDir'>
) => {
if (value) {
return value;
}
const staticDirs = await options.presets.apply<StorybookConfig['staticDirs']>('staticDirs');
const staticDirsValue = await options.presets.apply<StorybookConfig['staticDirs']>('staticDirs');

const statics = staticDirs
? staticDirs.map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`))
const statics = staticDirsValue
? staticDirsValue.map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`))
: options.staticDir;

if (statics && statics.length > 0) {
const lists = await Promise.all(
statics.map(async (dir) => {
const results = [];
const relativeDir = staticDirs
const relativeDir = staticDirsValue
? getDirectoryFromWorkingDir({
configDir: options.configDir,
workingDir: process.cwd(),
Expand Down
1 change: 0 additions & 1 deletion code/lib/theming/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const typography = {
weight: {
regular: 400,
bold: 700,
black: 900,
},
size: {
s1: 12,
Expand Down
2 changes: 1 addition & 1 deletion code/ui/blocks/src/components/ArgsTable/SectionRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Section = styled.td(({ theme }) => ({
position: 'relative',
letterSpacing: '0.35em',
textTransform: 'uppercase',
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
fontSize: theme.typography.size.s1 - 1,
color:
theme.base === 'light'
Expand Down
4 changes: 2 additions & 2 deletions code/ui/blocks/src/components/DocsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface DocsPageProps {
export const Title = styled.h1(withReset, ({ theme }) => ({
color: theme.color.defaultText,
fontSize: theme.typography.size.m3,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
lineHeight: '32px',

[`@media (min-width: ${breakpoint}px)`]: {
Expand Down Expand Up @@ -197,7 +197,7 @@ export const DocsContent = styled.div(({ theme }) => {
...reset,
...headers,
fontSize: `${theme.typography.size.l1}px`,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
},
[toGlobalSelector('h2')]: {
...reset,
Expand Down
2 changes: 1 addition & 1 deletion code/ui/blocks/src/components/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const breakpoint = 600;
export const Title = styled.h1(withReset, ({ theme }: { theme: Theme }) => ({
color: theme.color.defaultText,
fontSize: theme.typography.size.m3,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
lineHeight: '32px',

[`@media (min-width: ${breakpoint}px)`]: {
Expand Down
2 changes: 1 addition & 1 deletion code/ui/blocks/src/components/Typeset.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
};

const fontSizes = ['12px', '14px', '16px', '20px', '24px', '32px', '40px', '48px'];
const fontWeight = 900;
const fontWeight = 700;
const fontFamily = 'monospace';

export const WithFontSizes = () => <Typeset fontSizes={fontSizes} />;
Expand Down
4 changes: 2 additions & 2 deletions code/ui/components/src/tooltip/TooltipMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { styled } from '@storybook/theming';
import { Link } from '../typography/link/link';

const Title = styled.div(({ theme }) => ({
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
}));

const Desc = styled.span();
Expand All @@ -16,7 +16,7 @@ const Links = styled.div(({ theme }) => ({

'> *': {
margin: '0 8px',
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
},
}));

Expand Down
2 changes: 1 addition & 1 deletion code/ui/components/src/typography/DocumentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const DocumentWrapper = styled.div(({ theme }) => ({

h1: {
fontSize: `${theme.typography.size.l1}px`,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
},
h2: {
fontSize: `${theme.typography.size.m2}px`,
Expand Down
2 changes: 1 addition & 1 deletion code/ui/components/src/typography/elements/H1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { withReset, headerCommon } from '../lib/common';

export const H1 = styled.h1(withReset, headerCommon, ({ theme }) => ({
fontSize: `${theme.typography.size.l1}px`,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
}));
2 changes: 1 addition & 1 deletion code/ui/components/src/typography/typography.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ font-family:
<Typeset
fontFamily={typography.fonts.base}
fontSizes={fontSizes}
fontWeight={typography.weight.black}
fontWeight={typography.weight.bold}
sampleText={sampleText}
/>

Expand Down
1 change: 1 addition & 0 deletions code/ui/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"static/**/*",
"README.md",
"*.js",
"*.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion code/ui/manager/src/components/sidebar/Refs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Wrapper = styled.div<{ isMain: boolean }>(({ isMain }) => ({
}));

const RefHead = styled.div(({ theme }) => ({
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
fontSize: theme.typography.size.s2 - 1,

// Similar to ListItem.tsx
Expand Down
2 changes: 1 addition & 1 deletion code/ui/manager/src/components/sidebar/TreeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const RootNode = styled.div(({ theme }) => ({
marginTop: 16,
marginBottom: 4,
fontSize: `${theme.typography.size.s1 - 1}px`,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
lineHeight: '16px',
minHeight: 20,
letterSpacing: '0.35em',
Expand Down
4 changes: 2 additions & 2 deletions code/ui/manager/src/settings/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Header = styled.header(({ theme }) => ({
marginBottom: 20,
fontSize: theme.typography.size.m3,
color: theme.base === 'light' ? theme.color.darkest : theme.color.lightest,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
alignItems: 'center',
display: 'flex',

Expand All @@ -27,7 +27,7 @@ const Header = styled.header(({ theme }) => ({
const Subheading = styled.span(({ theme }) => ({
letterSpacing: '0.35em',
textTransform: 'uppercase',
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
fontSize: theme.typography.size.s2 - 1,
lineHeight: '24px',
color: theme.textMutedColor,
Expand Down
2 changes: 1 addition & 1 deletion code/ui/manager/src/settings/shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SettingsFooter from './SettingsFooter';
const Header = styled.header(({ theme }) => ({
marginBottom: 20,
fontSize: theme.typography.size.m3,
fontWeight: theme.typography.weight.black,
fontWeight: theme.typography.weight.bold,
alignItems: 'center',
display: 'flex',
}));
Expand Down
31 changes: 31 additions & 0 deletions code/ui/manager/static/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('./nunito-sans-regular.woff2') format('woff2');
}

@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url('./nunito-sans-italic.woff2') format('woff2');
}

@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('./nunito-sans-bold.woff2') format('woff2');
}

@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url('./nunito-sans-bold-italic.woff2') format('woff2');
}
Binary file not shown.
Binary file added code/ui/manager/static/nunito-sans-bold.woff2
Binary file not shown.
Binary file added code/ui/manager/static/nunito-sans-italic.woff2
Binary file not shown.
Binary file not shown.
Loading