Skip to content

Commit

Permalink
Improve text sizing treatment
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Sep 12, 2024
1 parent 365842e commit 5800256
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/Playroom/Snippets/Snippets.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const snippetsContainer = style([
export const snippet = style([
sprinkles({
position: 'relative',
display: 'block',
cursor: 'pointer',
paddingY: 'large',
paddingX: 'xlarge',
Expand All @@ -57,7 +58,7 @@ export const snippet = style([
color: colorPaletteVars.foreground.neutral,
backgroundColor: colorPaletteVars.background.surface,
'::before': {
content: '""',
content: '',
position: 'absolute',
top: 0,
bottom: 0,
Expand Down
14 changes: 8 additions & 6 deletions src/Playroom/Snippets/Snippets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { useDebouncedCallback } from 'use-debounce';
import type { PlayroomProps } from '../Playroom';
import type { Snippet } from '../../../utils';
import SearchField from './SearchField/SearchField';
import { Strong } from '../Strong/Strong';
import { Text } from '../Text/Text';

import * as styles from './Snippets.css';
import { Stack } from '../Stack/Stack';

type HighlightIndex = number | null;
type ReturnedSnippet = Snippet | null;
Expand Down Expand Up @@ -151,12 +151,14 @@ export default ({ snippets, onHighlight, onClose }: Props) => {
onMouseDown={() => closeHandler(filteredSnippets[index])}
title={getLabel(snippet)}
>
<span style={{ display: 'block', position: 'relative' }}>
<Text size="large">
<Strong>{snippet.group}</Strong>
<span className={styles.snippetName}>{snippet.name}</span>
<Stack space="none">
<Text size="large" weight="strong">
{snippet.group}
</Text>
</span>
<Text size="large" tone="secondary">
{snippet.name}
</Text>
</Stack>
</li>
);
})}
Expand Down
4 changes: 4 additions & 0 deletions src/Playroom/Text/Text.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export const critical = style({
color: colorPaletteVars.foreground.critical,
});

export const secondary = style({
color: colorPaletteVars.foreground.secondary,
});

export const xsmall = sprinkles({
font: 'xsmall',
});
Expand Down
2 changes: 1 addition & 1 deletion src/Playroom/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as styles from './Text.css';
interface Props {
size?: 'xsmall' | 'small' | 'standard' | 'large';
weight?: 'regular' | 'strong';
tone?: 'neutral' | 'critical';
tone?: 'neutral' | 'secondary' | 'critical';
as?: ElementType;
truncate?: boolean;
children: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/Playroom/vars.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const vars = createGlobalTheme(':root', {
xsmall: `normal 10px ${fontFamily}`,
small: `normal 12px ${fontFamily}`,
standard: `normal 14px ${fontFamily}`,
large: `normal 16px/1.3em ${fontFamily}`,
large: `normal 16px/20px ${fontFamily}`,
},
weight: {
weak: '100',
Expand Down

0 comments on commit 5800256

Please sign in to comment.