Skip to content

Commit

Permalink
refactor(site/typography): rename Typography to typography, add index…
Browse files Browse the repository at this point in the history
….ts like system, unify with export arrow func style
  • Loading branch information
sukvvon committed Aug 31, 2024
1 parent 0159227 commit 729cae3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classnames from 'classnames';

import * as styles from './typography.css';
import { Box } from '../system';
import { sprinkles, Sprinkles } from '../system/styles/sprinkles.css';
import { sprinkles, Sprinkles } from '../system/styles';

export type HeadingLevel = keyof typeof styles.heading;

Expand Down
File renamed without changes.
13 changes: 8 additions & 5 deletions site/src/Typography/Link.tsx → site/src/typography/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Link, LinkProps } from 'react-router-dom';
import {
Link as RouterLink,
LinkProps as RouterLinkProps,
} from 'react-router-dom';
import { HashLink } from 'react-router-hash-link';
import classnames from 'classnames';
import { TextProps, useTextStyles } from './Text';
import * as styles from './Link.css';
import { sprinkles } from '../system/styles/sprinkles.css';

interface Props extends LinkProps {
export interface LinkProps extends RouterLinkProps {
baseline?: boolean;
size?: 'standard' | 'small' | 'xsmall';
underline?: 'always' | 'hover' | 'never';
Expand All @@ -16,7 +19,7 @@ interface Props extends LinkProps {
inline?: boolean;
highlightOnFocus?: boolean;
}
export default ({
export const Link = ({
to,
baseline = false,
size = 'standard',
Expand All @@ -28,7 +31,7 @@ export default ({
inline = false,
className,
...restProps
}: Props) => {
}: LinkProps) => {
const classNames = classnames(
inline ? undefined : sprinkles({ display: 'block' }),
underline === 'hover' ? styles.underlineOnHover : undefined,
Expand All @@ -47,7 +50,7 @@ export default ({
}

return (
<Link
<RouterLink
onClick={() => window.scrollTo(0, 0)}
to={to}
{...restProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const useTextStyles = ({
styles.weight[weight],
);

export default ({
export const Text = ({
component = 'span',
size,
color,
Expand Down
8 changes: 8 additions & 0 deletions site/src/typography/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export {
Heading,
useHeadingStyles,
type HeadingProps,
type HeadingLevel,
} from './Heading';
export { Link, type LinkProps } from './Link';
export { Text, useTextStyles, type TextProps } from './Text';
File renamed without changes.

0 comments on commit 729cae3

Please sign in to comment.