Skip to content

Commit 971d584

Browse files
ktaborsLFDanLu
andauthored
improving locale font-family using postCSS silent placeholders (#2057)
* improving locale font-family using postCSS silent placeholders for extend * making the placeholder only font-family * using the correct hebrew font from spectrum-dna * small fix for vertical buttongroup story due to smaller font size Co-authored-by: Daniel Lu <[email protected]>
1 parent 2d3ef98 commit 971d584

File tree

6 files changed

+34
-32
lines changed

6 files changed

+34
-32
lines changed

packages/@adobe/spectrum-css-temp/components/button/index.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ governing permissions and limitations under the License.
6262
box-shadow var(--spectrum-global-animation-duration-100) ease-out;
6363

6464
text-decoration: none;
65-
font-family: var(--spectrum-font-family-base);
65+
66+
@extend %i18nFontFamily;
6667

6768
line-height: var(--spectrum-button-line-height);
6869

packages/@adobe/spectrum-css-temp/components/commons/fonts.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,31 @@ governing permissions and limitations under the License.
4141
--spectrum-text-size-text-label: var(--spectrum-label-text-size);
4242
--spectrum-line-height-text-label: var(--spectrum-label-text-line-height);
4343
}
44+
45+
%i18nFontFamily {
46+
font-family: var(--spectrum-font-family-base);
47+
48+
&:lang(ar) {
49+
font-family: var(--spectrum-font-family-ar);
50+
}
51+
52+
&:lang(he) {
53+
font-family: var(--spectrum-font-family-he);
54+
}
55+
56+
&:lang(zh-Hans) {
57+
font-family: var(--spectrum-font-family-zhhans);
58+
}
59+
60+
&:lang(zh) {
61+
font-family: var(--spectrum-font-family-zh);
62+
}
63+
64+
&:lang(ko) {
65+
font-family: var(--spectrum-font-family-ko);
66+
}
67+
68+
&:lang(ja) {
69+
font-family: var(--spectrum-font-family-ja);
70+
}
71+
}

packages/@adobe/spectrum-css-temp/components/textfield/index.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ governing permissions and limitations under the License.
2727
--spectrum-textfield-multiline-padding-x: var(--spectrum-textfield-padding-x);
2828
--spectrum-textfield-multiline-padding-top: var(--spectrum-textfield-padding-top);
2929
--spectrum-textfield-multiline-padding-bottom: var(--spectrum-textfield-padding-bottom);
30-
31-
/* Todo: DNA uses incorrect font family "Adobe Clean" */;
32-
--spectrum-textfield-text-font-family-fixed: var(--spectrum-font-family-base);
3330
}
3431

3532
.spectrum-Textfield {
@@ -72,7 +69,7 @@ governing permissions and limitations under the License.
7269
overflow: visible;
7370

7471
/* Change the input font styles in all browsers */
75-
font-family: var(--spectrum-textfield-text-font-family-fixed);
72+
@extend %i18nFontFamily;
7673
font-size: var(--spectrum-textfield-text-size);
7774
line-height: var(--spectrum-textfield-text-line-height);
7875
text-overflow: ellipsis;

packages/@adobe/spectrum-css-temp/components/typography/font.css

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,7 @@ governing permissions and limitations under the License.
1212
@import '../commons/index.css';
1313

1414
.spectrum {
15-
font-family: var(--spectrum-font-family-base);
15+
@extends %i18nFontFamily;
1616
font-size: var(--spectrum-text-size);
1717
color: var(--spectrum-body-text-color, var(--spectrum-global-color-gray-800));
18-
19-
&:lang(ar) {
20-
font-family: var(--spectrum-font-family-ar);
21-
}
22-
23-
&:lang(he) {
24-
font-family: var(--spectrum-font-family-he);
25-
}
26-
27-
&:lang(zh-Hans) {
28-
font-family: var(--spectrum-font-family-zhhans);
29-
}
30-
31-
&:lang(zh) {
32-
font-family: var(--spectrum-font-family-zh);
33-
}
34-
35-
&:lang(ko) {
36-
font-family: var(--spectrum-font-family-ko);
37-
}
38-
39-
&:lang(ja) {
40-
font-family: var(--spectrum-font-family-ja);
41-
}
4218
}

packages/@adobe/spectrum-css-temp/components/typography/vars.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
font-family: myriad-arabic, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
1919
}
2020
.spectrum:lang(he) {
21-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
21+
font-family: myraid-hebrew, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
2222
}
2323
.spectrum:lang(zh-Hans) {
2424
font-family: adobe-clean-han-japanese, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

packages/@react-spectrum/buttongroup/chromatic/ButtonGroup.chromatic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function render(props) {
5252
</ButtonGroup>
5353
</View>
5454
<View borderColor="static-blue-400" borderWidth="thin">
55-
<ButtonGroup width="size-2000" {...props}>
55+
<ButtonGroup width="size-1700" {...props}>
5656
<Button variant="primary">Button 1</Button>
5757
<Button variant="primary">Button 2</Button>
5858
</ButtonGroup>

0 commit comments

Comments
 (0)