-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Changes from 15 commits
01bd964
b79f475
068da66
ba50445
a7fc816
7b806b5
58c0ccc
f5de13a
a6df602
701450d
3787639
ec29f50
b5b602e
2b54537
9097c15
77b72b1
156350d
7f07155
a937d59
f91042c
4bea39d
eb5db08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
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', | ||
component: IllustratedMessage, | ||
parameters: { | ||
chromaticProvider: { | ||
colorSchemes: ['light'], | ||
locales: ['en-US', 'ar-AE', 'zh-CN', 'zh-TW', 'ja-JP', 'ko-KR'], | ||
scales: ['large'], | ||
snowystinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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' | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
|
@@ -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: ( | ||
|
@@ -118,6 +110,35 @@ storiesOf('Textfield', module) | |
)}, false) | ||
); | ||
|
||
storiesOf('Languages/Textfield', module) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,64 @@ | |
font-weight: 900; | ||
} | ||
|
||
/** pulled from web project id: 'uei1lip' */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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=ALL&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=ALL&v=3"); | ||
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"; | ||
|
There was a problem hiding this comment.
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.