diff --git a/src/lib/theme/type.tsx b/src/lib/theme/type.tsx index a68427e0fe..05bd3b91b8 100644 --- a/src/lib/theme/type.tsx +++ b/src/lib/theme/type.tsx @@ -5,10 +5,11 @@ import { Color } from './theme' type TextProps = Omit & { color?: Color } -const TextWrapper = styled(Text)<{ color?: Color; lineHeight: string }>` +const TextWrapper = styled(Text)<{ color?: Color; lineHeight: string; noWrap?: true }>` color: ${({ color = 'currentColor', theme }) => theme[color as Color]}; // Avoid the need for placeholders by setting min-height to line-height. min-height: ${({ lineHeight }) => lineHeight}; + white-space: ${({ noWrap }) => noWrap && 'nowrap'}; ` const TransitionTextWrapper = styled(TextWrapper)` @@ -16,23 +17,33 @@ const TransitionTextWrapper = styled(TextWrapper)` ` export function H1(props: TextProps) { - return + return ( + + ) } export function H2(props: TextProps) { - return + return ( + + ) } export function H3(props: TextProps) { - return + return ( + + ) } export function Subhead1(props: TextProps) { - return + return ( + + ) } export function Subhead2(props: TextProps) { - return + return ( + + ) } export function Body1(props: TextProps) { @@ -48,19 +59,25 @@ export function Caption(props: TextProps) { } export function Badge(props: TextProps) { - return + return } export function ButtonLarge(props: TextProps) { - return + return ( + + ) } export function ButtonMedium(props: TextProps) { - return + return ( + + ) } export function ButtonSmall(props: TextProps) { - return + return ( + + ) } export function TransitionButton(props: TextProps & { buttonSize: 'small' | 'medium' | 'large' }) { @@ -73,6 +90,7 @@ export function TransitionButton(props: TextProps & { buttonSize: 'small' | 'med fontSize={fontSize} fontWeight={500} lineHeight={lineHeight} + noWrap {...props} /> )