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

Font improvements, loading fonts in Storybook, and adding more font Chromatic stories #4238

Merged
merged 22 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
01bd964
additional font loading for storybook and chromatic font stories
ktabors Mar 21, 2023
b79f475
adding a zh-Hant font story
ktabors Mar 21, 2023
068da66
using a single fonts web project to proload fonts
ktabors Mar 23, 2023
ba50445
Merge branch 'main' into ccjk_font
ktabors Mar 23, 2023
a7fc816
since we don't have all font weights we still want that font-synthesis
ktabors Mar 23, 2023
7b806b5
Merge branch 'ccjk_font' of github.com:adobe/react-spectrum into ccjk…
ktabors Mar 23, 2023
58c0ccc
Merge branch 'main' into ccjk_font
ktabors Mar 23, 2023
f5de13a
moving a couple stories to new chromatic languages group
ktabors Mar 23, 2023
a6df602
removing zh-TW locale from all TextArea stories
ktabors Mar 23, 2023
701450d
Merge branch 'main' into ccjk_font
ktabors Mar 27, 2023
3787639
trying to load the fonts before chromatic screenshots
ktabors Mar 27, 2023
ec29f50
Merge branch 'ccjk_font' of github.com:adobe/react-spectrum into ccjk…
ktabors Mar 27, 2023
b5b602e
improving chinese locale selection
ktabors Mar 28, 2023
2b54537
myriad arabic with features all
ktabors Mar 28, 2023
9097c15
adding the features=all to Myriad Arabic for docs
ktabors Mar 29, 2023
77b72b1
Merge branch 'main' into ccjk_font
LFDanLu Mar 29, 2023
156350d
adding picker placeholder stores and using scales large and medium
ktabors Mar 29, 2023
7f07155
storybook will load the fonts, but not preload them
ktabors Mar 29, 2023
a937d59
improving the locale and scale for Chromatic Languages/ActionButton
ktabors Mar 29, 2023
f91042c
Merge branch 'ccjk_font' of github.com:adobe/react-spectrum into ccjk…
ktabors Mar 29, 2023
4bea39d
Merge branch 'main' into ccjk_font
snowystinger Mar 29, 2023
eb5db08
Merge branch 'main' into ccjk_font
devongovett Apr 5, 2023
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
208 changes: 149 additions & 59 deletions .chromatic/preview-head.html

Large diffs are not rendered by default.

149 changes: 148 additions & 1 deletion .storybook/preview-head.html

Large diffs are not rendered by default.

36 changes: 25 additions & 11 deletions packages/@adobe/spectrum-css-temp/components/commons/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ governing permissions and limitations under the License.
*/

:root {
--spectrum-font-fallbacks-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--spectrum-font-fallbacks-sans: adobe-clean, 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Trebuchet MS', 'Lucida Grande', sans-serif;

font-synthesis: weight;

/* Not used
--spectrum-font-fallbacks-serif: serif;
Expand All @@ -27,15 +29,15 @@ governing permissions and limitations under the License.
--spectrum-font-family-condensed: adobe-clean-condensed, var(--spectrum-font-family-base);
*/

--spectrum-font-family-base: 'adobe-clean-ux', 'adobe-clean', 'Source Sans Pro', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-base: var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-han: 'adobe-clean-han-japanese', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-ar: 'adobe-arabic', 'myriad-arabic', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-he: 'adobe-hebrew', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-zhhans: 'adobe-clean-han-simplified-c', 'SimSun', 'Heiti SC Light', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-zh: var(--spectrum-font-family-zhhans);
--spectrum-font-family-zhhant: 'adobe-clean-han-traditional', 'Microsoft JhengHei UI', 'Microsoft JhengHei', 'Heiti TC Light', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-ko: 'adobe-clean-han-korean', 'Malgun Gothic', 'Apple Gothic', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-ja: 'adobe-clean-han-japanese', 'Yu Gothic', '\30E1 \30A4 \30EA \30AA', '\30D2 \30E9 \30AE \30CE \89D2 \30B4 Pro W3', 'Hiragino Kaku Gothic Pro W3', 'Osaka', '\FF2D \FF33 \FF30 \30B4 \30B7 \30C3 \30AF', 'MS PGothic', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-ar: 'myriad-arabic', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-he: 'myriad-hebrew', var(--spectrum-font-fallbacks-sans);
--spectrum-font-family-zhhans: adobe-clean-han-simplified-c, source-han-simplified-c, 'SimSun', 'Heiti SC Light', sans-serif;
--spectrum-font-family-zh: adobe-clean-han-traditional, source-han-traditional, 'MingLiu', 'Heiti TC Light', sans-serif;
--spectrum-font-family-zhhant: adobe-clean-han-traditional, source-han-traditional, 'MingLiu', 'Microsoft JhengHei UI', 'Microsoft JhengHei', 'Heiti TC Light', sans-serif;
--spectrum-font-family-ko: adobe-clean-han-korean, source-han-korean, 'Malgun Gothic', 'Apple Gothic', sans-serif;
--spectrum-font-family-ja: adobe-clean-han-japanese, 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN W3', Osaka, YuGothic, 'Yu Gothic', 'メイリオ', Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif;
--spectrum-text-size: var(--spectrum-alias-font-size-default);
--spectrum-text-body-line-height: var(--spectrum-alias-line-height-medium);
--spectrum-text-size-text-label: var(--spectrum-label-text-size);
Expand All @@ -53,12 +55,24 @@ governing permissions and limitations under the License.
font-family: var(--spectrum-font-family-he);
}

&:lang(zh) {
font-family: var(--spectrum-font-family-zh);
}

&:lang(zh-Hans) {
font-family: var(--spectrum-font-family-zhhans);
}

&:lang(zh) {
font-family: var(--spectrum-font-family-zh);
&:lang(zh-Hant) {
font-family: var(--spectrum-font-family-zhhant);
}

&:lang(zh-SG) {
font-family: var(--spectrum-font-family-zhhans);
}

&:lang(zh-CN) {
font-family: var(--spectrum-font-family-zhhans);
}

&:lang(ko) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ storiesOf('Button/ActionButton', module)
</Flex>
</View>
)
)
);

storiesOf('Languages/ActionButton', module)
.addParameters({chromaticProvider: {locales: ['en-US', 'ja-JP']}})
.add(
'Japanese, icon + text, staticColor: white',
() => (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {ComponentMeta, ComponentStoryObj} from '@storybook/react';
import {Content} from '@react-spectrum/view';
import {Flex} from '@react-spectrum/layout';
import {Heading} from '@react-spectrum/text';
import {IllustratedMessage} from '..';
import NotFound from '@spectrum-icons/illustrations/src/NotFound';
import React from 'react';

type IllustratedMessageStory = ComponentStoryObj<typeof IllustratedMessage>;

export default {
title: 'Languages/IllustratedMessage',
Copy link
Member Author

@ktabors ktabors Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposing all Chromatic font stories are in a "Languages" package, so we can more easily adjust locales without impacting other stories and they aren't spread all over the place.

component: IllustratedMessage,
parameters: {
chromaticProvider: {
colorSchemes: ['light'],
locales: ['en-US', 'ar-AE', 'zh-CN', 'zh-TW', 'ja-JP', 'ko-KR'],
scales: ['large'],
express: false
}
}
} as ComponentMeta<typeof IllustratedMessage>;

export const _NotFound: IllustratedMessageStory = {
render: () => (
<Flex gap="size-200" direction="row" wrap>
<IllustratedMessage width="size-2000">
<NotFound />
<Heading>Error 404</Heading>
<Content>Page not found</Content>
</IllustratedMessage>
<IllustratedMessage width="size-2000">
<NotFound />
<Heading>404 خطأ</Heading>
<Content>الصفحة غير موجودة</Content>
</IllustratedMessage>
<IllustratedMessage width="size-2000">
<NotFound />
<Heading>错误 404</Heading>
<Content>找不到网页</Content>
</IllustratedMessage>
<IllustratedMessage width="size-2000">
<NotFound />
<Heading>錯誤 404</Heading>
<Content>找不到網頁</Content>
</IllustratedMessage>
<IllustratedMessage width="size-2000">
<NotFound />
<Heading>エラー 404</Heading>
<Content>ページが見つかりません</Content>
</IllustratedMessage>
<IllustratedMessage width="size-2000">
<NotFound />
<Heading>오류 404</Heading>
<Content>페이지를 찾을 수 없음</Content>
</IllustratedMessage>
</Flex>
),
name: 'Not found: no italic in CCJK'
};
13 changes: 12 additions & 1 deletion packages/@react-spectrum/provider/stories/Provider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,18 @@ storiesOf('Provider', module)
<Breakpoint />
</Provider>
);
});
})
.add(
'locale: zh-Hant',
() => (
<div>
<div>Heaven and earth are mysterious and yellow, the universe is prehistoric</div>
<Provider locale="zh-Hant">
<div>天地玄黃,宇宙洪荒</div>
</Provider>
</div>
)
);

function render(props = {}) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@ storiesOf('StatusLight', module)
)
);

storiesOf('Languages/StatusLight', module)
.addParameters({
chromaticProvider: {
colorSchemes: ['light'],
express: false,
locales: ['en-US', 'ar-AE', 'zh-CN', 'zh-TW', 'ja-JP', 'ko-KR'],
scales: ['large']
}
})
.add(
'Neutral: no italic in CCJK',
() => (
<Flex gap="size-200" direction="row" wrap>
<StatusLight variant="neutral">Help</StatusLight>
<StatusLight variant="neutral">مساعدة</StatusLight>
<StatusLight variant="neutral">帮助</StatusLight>
<StatusLight variant="neutral">說明</StatusLight>
<StatusLight variant="neutral">ヘルプ</StatusLight>
<StatusLight variant="neutral">도움말</StatusLight>
</Flex>
)
);

function render() {
return (
<Flex wrap>
Expand Down
28 changes: 19 additions & 9 deletions packages/@react-spectrum/textfield/chromatic/TextArea.chromatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {storiesOf} from '@storybook/react';
import {TextArea} from '../';

storiesOf('TextArea', module)
.addParameters({chromaticProvider: {locales: ['en-US', 'ar-AE', 'zh-TW']}})
.addParameters({chromaticProvider: {locales: ['en-US', 'ar-AE']}})
.add(
'Default',
() => render()
Expand Down Expand Up @@ -85,14 +85,6 @@ storiesOf('TextArea', module)
.add('custom height',
() => render({icon: <Info />, validationState: 'invalid', height: 350})
)
.add(
'value: 測試, icon: Info, labelPosition: side, validationState: valid',
() => render({value: '測試', icon: <Info />, labelPosition: 'side', validationState: 'valid'})
)
.add(
'value: اختبار, isRequired: false, necessityIndicator: label',
() => render({value: 'اختبار', isRequired: false, necessityIndicator: 'label'})
)
.add(
'contextual help',
args => render({...args, contextualHelp: (
Expand Down Expand Up @@ -121,6 +113,24 @@ storiesOf('TextArea', module)
)}, false)
);

storiesOf('Languages/TextArea', module)
.addParameters({
chromaticProvider: {
colorSchemes: ['light'],
express: false,
locales: ['en-US', 'ar-AE', 'zh-TW'],
scales: ['large']
}
})
.add(
'value: 測試, icon: Info, labelPosition: side, validationState: valid',
() => render({value: '測試', icon: <Info />, labelPosition: 'side', validationState: 'valid'})
)
.add(
'value: اختبار, isRequired: false, necessityIndicator: label',
() => render({value: 'اختبار', isRequired: false, necessityIndicator: 'label'})
);

// allow some stories where disabled styles probably won't affect anything to turn that off, mostly to reduce clutter
function render(props = {}, disabled = true) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {storiesOf} from '@storybook/react';
import {TextField} from '../';

storiesOf('Textfield', module)
.addParameters({chromaticProvider: {locales: ['en-US', 'ar-AE', 'zh-TW']}})
.addParameters({chromaticProvider: {locales: ['en-US', 'ar-AE']}})
.add(
'Default',
() => render()
Expand Down Expand Up @@ -82,14 +82,6 @@ storiesOf('Textfield', module)
.add('custom width',
() => render({icon: <Info />, validationState: 'invalid', width: 275})
)
.add(
'value: 測試, icon: Info, labelPosition: side, validationState: valid',
() => render({value: '測試', icon: <Info />, labelPosition: 'side', validationState: 'valid'})
)
.add(
'value: اختبار, isRequired: false, necessityIndicator: label',
() => render({value: 'اختبار', isRequired: false, necessityIndicator: 'label'})
)
.add(
'contextual help',
args => render({...args, contextualHelp: (
Expand Down Expand Up @@ -118,6 +110,35 @@ storiesOf('Textfield', module)
)}, false)
);

storiesOf('Languages/Textfield', module)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this story to confirm the state of #3983 with the correct fonts, which is currently a failure.

.addParameters({
chromaticProvider: {
colorSchemes: ['light'],
express: false,
locales: ['en-US', 'ar-AE', 'fr-FR', 'de-DE', 'zh-TW'],
scales: ['large']
}
})
.add(
'diacritics',
() => (
<Flex gap="size-200" direction="row" wrap>
<TextField label="Label" value="value" />
<TextField label="رِفِتـــانٍ خانٍِ" value="رِفِتـــانٍ خانٍِ" />
<TextField label="Ç" value="Ç" />
<TextField label="Äpfel" value="Äpfel" />
</Flex>
)
)
.add(
'value: 測試, icon: Info, labelPosition: side, validationState: valid',
() => render({value: '測試', icon: <Info />, labelPosition: 'side', validationState: 'valid'})
)
.add(
'value: اختبار, isRequired: false, necessityIndicator: label',
() => render({value: 'اختبار', isRequired: false, necessityIndicator: 'label'})
);

// allow some stories where disabled styles probably won't affect anything to turn that off, mostly to reduce clutter
function render(props = {}, disabled = true) {
return (
Expand Down
58 changes: 58 additions & 0 deletions packages/dev/docs/src/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,64 @@
font-weight: 900;
}

/** pulled from web project id: 'uei1lip' */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow docs to load the correct font if someone loads the page from an Arabic, Hebrew, Japanese, Korean, or Chinese locale and a component shows a i18n string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we could do what we do here in our storybook

@font-face {
font-family: "myriad-arabic";
src: url("https://use.typekit.net/af/ad6dbc/00000000000000007735a300/30/l?unicode=AAAHygAAAAdhg4V2jXrgvTqablOmIuR90xJ6f7oYX7HHszHOhbuHChMcgQn5RM8D_2_09h-EDof5QbhEgbbA63nwPrW_c-fWpSq9I3W2wnPr2mXL5hwU9XCfpfCkLYjBT4lM8H7L4ONWX3ugfaTSwXm4HDcbyteaHuCpkuHywfcZB3Qmfrf-lhmtbmdiEYP1_3wmtwTqUe-84RpPif-WvZba-nEoqF8x54v53DpQrOTj48ldu33mIr3t5_p7J-7EIbKWiAPY-6fOlmzgfKcT52EWvLAE-pP79aefMQlHioFliM5EGken-uDgxR0sm5rfhBd4WUTkH-k-gPs7g-WyugAAAb0&features=NONE&v=3");
font-display: swap;
font-style: normal;
font-weight: 400;
}
@font-face {
font-family: "myriad-arabic";
src: url("https://use.typekit.net/af/d1936b/00000000000000007735a2fd/30/l?unicode=AAAHygAAAAdhg4V2jXrgvTqablOmIuR90xJ6f7oYX7HHszHOhbuHChMcgQn5RM8D_2_09h-EDof5QbhEgbbA63nwPrW_c-fWpSq9I3W2wnPr2mXL5hwU9XCfpfCkLYjBT4lM8H7L4ONWX3ugfaTSwXm4HDcbyteaHuCpkuHywfcZB3Qmfrf-lhmtbmdiEYP1_3wmtwTqUe-84RpPif-WvZba-nEoqF8x54v53DpQrOTj48ldu33mIr3t5_p7J-7EIbKWiAPY-6fOlmzgfKcT52EWvLAE-pP79aefMQlHioFliM5EGken-uDgxR0sm5rfhBd4WUTkH-k-gPs7g-WyugAAAb0&features=NONE&v=3");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these ones need to have features=ALL as well?

font-display: swap;
font-style: italic;
font-weight: 400;
}
@font-face {
font-family: "myriad-hebrew";
src: url("https://use.typekit.net/af/e6598e/00000000000000007735a31b/30/l?unicode=AAAHygAAAAdhg4V2jXrgvTqablOmIuR90xJ6f7oYX7HHszHOhbuHChMcgQn5RM8D_2_09h-EDof5QbhEgbbA63nwPrW_c-fWpSq9I3W2wnPr2mXL5hwU9XCfpfCkLYjBT4lM8H7L4ONWX3ugfaTSwXm4HDcbyteaHuCpkuHywfcZB3Qmfrf-lhmtbmdiEYP1_3wmtwTqUe-84RpPif-WvZba-nEoqF8x54v53DpQrOTj48ldu33mIr3t5_p7J-7EIbKWiAPY-6fOlmzgfKcT52EWvLAE-pP79aefMQlHioFliM5EGken-uDgxR0sm5rfhBd4WUTkH-k-gPs7g-WyugAAAb0&features=ALL&v=3");
font-display: swap;
font-style: normal;
font-weight: 400;
}
@font-face {
font-family: "myriad-hebrew";
src: url("https://use.typekit.net/af/26f595/00000000000000007735a313/30/l?unicode=AAAHygAAAAdhg4V2jXrgvTqablOmIuR90xJ6f7oYX7HHszHOhbuHChMcgQn5RM8D_2_09h-EDof5QbhEgbbA63nwPrW_c-fWpSq9I3W2wnPr2mXL5hwU9XCfpfCkLYjBT4lM8H7L4ONWX3ugfaTSwXm4HDcbyteaHuCpkuHywfcZB3Qmfrf-lhmtbmdiEYP1_3wmtwTqUe-84RpPif-WvZba-nEoqF8x54v53DpQrOTj48ldu33mIr3t5_p7J-7EIbKWiAPY-6fOlmzgfKcT52EWvLAE-pP79aefMQlHioFliM5EGken-uDgxR0sm5rfhBd4WUTkH-k-gPs7g-WyugAAAb0&features=ALL&v=3");
font-display: swap;
font-style: italic;
font-weight: 400;
}
@font-face {
font-family: "adobe-clean-han-japanese";
src: url("https://use.typekit.net/af/3a5e38/00000000000000007735dabb/30/m?features=ALL&v=4&chunks=511&order=0");
font-display: swap;
font-style: normal;
font-weight: 400;
}
@font-face {
font-family: "adobe-clean-han-korean";
src: url("https://use.typekit.net/af/d5dab5/00000000000000007735dabc/30/m?features=ALL&v=4&chunks=511&order=0");
font-display: swap;
font-style: normal;
font-weight: 400;
}
@font-face {
font-family: "adobe-clean-han-simplified-c";
src: url("https://use.typekit.net/af/e35bab/00000000000000007735dabd/30/m?features=ALL&v=4&chunks=511&order=0");
font-display: swap;
font-style: normal;
font-weight: 400;
}
@font-face {
font-family: "adobe-clean-han-traditional";
src: url("https://use.typekit.net/af/758ab2/00000000000000007735dabe/30/m?features=ALL&v=4&chunks=511&order=0");
font-display: swap;
font-style: normal;
font-weight: 400;
}

/* https://use.typekit.net/use4asx.css */
@font-face {
font-family: "Source Code Pro";
Expand Down