Skip to content

Commit 99feb19

Browse files
snowystingerGitHub Enterprise
authored and
GitHub Enterprise
committed
Merge pull request #1 from React/fix-font
Fix font
2 parents d6bbb26 + 331fc60 commit 99feb19

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

packages/@react-spectrum/s2/src/ActionButton.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Button as RACButton, Provider, TextContext} from 'react-aria-components'
1010
import {Text} from './Text';
1111
import {SpectrumActionButtonProps} from '@adobe/react-spectrum';
1212
import {tv} from 'tailwind-variants';
13-
import {FocusRing, useButton} from 'react-aria';
13+
import {FocusRing, mergeProps, useButton} from 'react-aria';
1414
import React, {CSSProperties, forwardRef, useLayoutEffect, useState} from 'react';
1515
import CornerTriangle from '@spectrum-icons/ui/CornerTriangle';
1616

@@ -29,7 +29,8 @@ export let baseIcon = tv({
2929
});
3030

3131
let baseButton = tv({
32-
base: ['box-border flex items-center justify-center border-solid border-none font-[inherit] font-bold cursor-default transition outline-none focus-visible:outline focus-visible:outline-offset disabled:text-disabled',
32+
// need to use outline-0 instead of none because none will show up always in hcm, but need to use outline-none so mouse outline doesn't show up
33+
base: ['box-border flex items-center justify-center border-solid border-none font-[inherit] font-bold cursor-default transition outline-none outline-0 focus-visible:outline focus-visible:outline-offset disabled:text-disabled',
3334
'transform duration pressed:perspective pressed:translate-z-[-2px]'],
3435
variants: {
3536
size: {
@@ -42,7 +43,7 @@ let baseButton = tv({
4243
XL: 'h-c-300 text-300 gap-ttv-100 rounded-[10px]'
4344
},
4445
isQuiet: {
45-
false: 'bg-tint-100 bg-hover-tint-200',
46+
false: 'bg-tint-100 bg-hover-tint-200', // don't need to use tint here
4647
true: 'bg-transparent bg-hover-gray-200' // how to use tint here?
4748
}
4849
},
@@ -170,7 +171,8 @@ export let staticColorButton = tv({
170171

171172
// do forward ref up here so that we get storybook types, at least until someone can figure out why we don't in our
172173
// normal codebase
173-
let ActionButton = forwardRef((props: SpectrumActionButtonProps & {size?: 'XS' | 'S' | 'M' | 'L' | 'XL'}, ref: FocusableRef<HTMLElement>) => {
174+
// remove onKeyUp from the types so that Storybook auto actions doesn't break press
175+
let ActionButton = forwardRef((props: Omit<SpectrumActionButtonProps & {size?: 'XS' | 'S' | 'M' | 'L' | 'XL'}, 'onKeyUp'>, ref: FocusableRef<HTMLElement>) => {
174176
props = useSlotProps(props, 'button');
175177
let {
176178
children,
@@ -190,6 +192,12 @@ let ActionButton = forwardRef((props: SpectrumActionButtonProps & {size?: 'XS' |
190192

191193
// how to make sure this stays up to date without calculating
192194
// while it's already scaled
195+
// only do during onPress, but that has to wait until we fix the onKeyUp bug OR disable that particular
196+
let onPress = () => {
197+
let {width = 0, height = 0} = domRef.current?.getBoundingClientRect() ?? {};
198+
setWidth(width);
199+
setHeight(height);
200+
};
193201
useLayoutEffect(() => {
194202
let {width = 0, height = 0} = domRef.current?.getBoundingClientRect() ?? {};
195203
setWidth(width);
@@ -199,12 +207,11 @@ let ActionButton = forwardRef((props: SpectrumActionButtonProps & {size?: 'XS' |
199207
// let styles = hasIcon && !hasLabel ? iconOnlyButton : buttonStyles;
200208
let styles = staticColor ? staticColorButton : buttonStyles;
201209

202-
console.log(props, styleProps)
203210
return (
204211
<FocusRing>
205212
<RACButton
206213
{...styleProps}
207-
{...props}
214+
{...(mergeProps(props, {onPress}))}
208215
ref={domRef as any}
209216
data-static-color={staticColor || undefined}
210217
data-has-icon={hasIcon || undefined}

packages/@react-spectrum/s2/src/Button.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {SpectrumButtonProps, Text} from '@adobe/react-spectrum';
1111
import {tv} from 'tailwind-variants';
1212
import {FocusRing, useButton} from 'react-aria';
1313
import React, {forwardRef, useEffect, useState} from 'react';
14-
import {pressScale, usePressScale} from './usePressScale';
14+
import {pressScale} from './usePressScale';
1515

1616
let baseButton = tv({
1717
base: 'flex items-center justify-center rounded-full font-[inherit] font-bold cursor-default transition outline-none focus-visible:ring disabled:text-disabled',
@@ -77,19 +77,7 @@ let buttonStyles = tv({
7777
class: 'border-base-tint-300 bg-hover-tint-300'
7878
}
7979
]
80-
}, {
81-
// twMergeConfig: {
82-
// theme: {
83-
// borderWidth: ['100', '200']
84-
// },
85-
// classGroups: {
86-
// tint: [{'tint': [() => true]}],
87-
// 'default-tint': [{'default-tint': [() => true]}],
88-
// 'font-size': [{text: []}]
89-
// }
90-
// }
91-
twMerge: false
92-
});
80+
}, {twMerge: false});
9381

9482
let staticColorButton = tv({
9583
extend: baseButton,

packages/@react-spectrum/s2/src/tailwind.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
src: url("./AdobeClownVF-Roman_crop.ttf");
99
font-display: swap;
1010
}
11+
12+
.s2.s2.s2 {
13+
font-family: "adobe-clown";
14+
}

tailwind-spectrum.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,6 @@ module.exports = {
948948
hover: colors[color][keys[i + 1]] || colors[color][index],
949949
focus: colors[color][keys[i + 1]] || colors[color][index],
950950
down: colors[color][keys[i + 1]] || colors[color][index]
951-
// down: colors[color][keys[i + 2]] || colors[color][keys[i + 1]] || colors[color][index]
952951
};
953952

954953
hoverColorValues[`${color}-${index}`] = {

0 commit comments

Comments
 (0)