Improve fonts and remove "family" prop

This commit is contained in:
danidfra 2024-11-25 21:21:53 -03:00
parent c070f64309
commit 23e6a46685
4 changed files with 9 additions and 14 deletions

View File

@ -45,11 +45,6 @@ const transformProperties = {
uppercase: 'uppercase', uppercase: 'uppercase',
}; };
const families = {
sans: 'font-sans',
mono: 'font-mono',
};
export type Sizes = keyof typeof sizes export type Sizes = keyof typeof sizes
type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'div' | 'blockquote' type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'div' | 'blockquote'
type Directions = 'ltr' | 'rtl' type Directions = 'ltr' | 'rtl'
@ -63,8 +58,6 @@ interface IText extends Pick<React.HTMLAttributes<HTMLParagraphElement>, 'danger
className?: string; className?: string;
/** Text direction. */ /** Text direction. */
direction?: Directions; direction?: Directions;
/** Typeface of the text. */
family?: keyof typeof families;
/** The "for" attribute specifies which form element a label is bound to. */ /** The "for" attribute specifies which form element a label is bound to. */
htmlFor?: string; htmlFor?: string;
/** Font size of the text. */ /** Font size of the text. */
@ -92,7 +85,6 @@ const Text = forwardRef<any, IText>(
align, align,
className, className,
direction, direction,
family = 'sans',
size = 'md', size = 'md',
tag = 'p', tag = 'p',
theme = 'default', theme = 'default',
@ -122,7 +114,6 @@ const Text = forwardRef<any, IText>(
[themes[theme]]: true, [themes[theme]]: true,
[weights[weight]]: true, [weights[weight]]: true,
[trackingSizes[tracking]]: true, [trackingSizes[tracking]]: true,
[families[family]]: true,
[alignmentClass]: typeof align !== 'undefined', [alignmentClass]: typeof align !== 'undefined',
[transformProperties[transform]]: typeof transform !== 'undefined', [transformProperties[transform]]: typeof transform !== 'undefined',
}, className)} }, className)}

View File

@ -56,7 +56,7 @@ const DevelopersChallenge = () => {
{/* eslint-enable formatjs/no-literal-string-in-jsx */} {/* eslint-enable formatjs/no-literal-string-in-jsx */}
</Text> </Text>
<Text tag='pre' family='mono' theme='muted'> <Text tag='pre' className='font-mono' theme='muted'>
{challenge} {challenge}
</Text> </Text>

View File

@ -29,6 +29,8 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
'no-reduce-motion': !reduceMotion, 'no-reduce-motion': !reduceMotion,
'underline-links': underlineLinks, 'underline-links': underlineLinks,
'demetricator': demetricator, 'demetricator': demetricator,
'font-arabic': ['ar', 'fa'].includes(locale),
'font-javanese': locale === 'jv',
}); });
useEffect(() => { useEffect(() => {
@ -48,10 +50,6 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{['dark', 'black'].includes(theme) && <style type='text/css'>{':root { color-scheme: dark; }'}</style>} {['dark', 'black'].includes(theme) && <style type='text/css'>{':root { color-scheme: dark; }'}</style>}
{/* eslint-disable formatjs/no-literal-string-in-jsx */} {/* eslint-disable formatjs/no-literal-string-in-jsx */}
<style type='text/css'>{`
html[lang='ar'] *, html[lang='fa'] * { font-family: 'Vazirmatn'; }
html[lang='jv'] * { font-family: 'Noto Sans Javanese'; }
`}</style>
{/* eslint-enable formatjs/no-literal-string-in-jsx */} {/* eslint-enable formatjs/no-literal-string-in-jsx */}
<meta name='theme-color' content={soapboxConfig.brandColor} /> <meta name='theme-color' content={soapboxConfig.brandColor} />
</Helmet> </Helmet>

View File

@ -27,6 +27,12 @@ const config: Config = {
base: '0.9375rem', base: '0.9375rem',
}, },
fontFamily: { fontFamily: {
arabic: [
'Vazirmatn',
],
javanese: [
'Noto Sans Javanese',
],
sans: [ sans: [
'Inter', 'Inter',
'ui-sans-serif', 'ui-sans-serif',