Skip to content

Commit

Permalink
feat(uikit-tags): Add typography props (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
hachiojidev authored Aug 19, 2021
1 parent 2262df1 commit 55ed86b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/pancake-uikit/src/components/Tag/StyledTag.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { DefaultTheme } from "styled-components";
import { space, variant } from "styled-system";
import { space, variant, typography } from "styled-system";
import { Colors } from "../../theme/types";
import { scaleVariants, styleVariants } from "./theme";
import { TagProps, variants } from "./types";
Expand Down Expand Up @@ -35,6 +35,8 @@ export const StyledTag = styled.div<ThemedProps>`
fill: currentColor;
}
${({ textTransform }) => textTransform && `text-transform: ${textTransform};`}
${variant({
prop: "scale",
variants: scaleVariants,
Expand All @@ -43,6 +45,7 @@ export const StyledTag = styled.div<ThemedProps>`
variants: styleVariants,
})}
${space}
${typography}
${getOutlineStyles}
`;
Expand Down
13 changes: 13 additions & 0 deletions packages/pancake-uikit/src/components/Tag/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,16 @@ export const Default: React.FC = () => {
</Box>
);
};

export const TextVariations: React.FC = () => {
return (
<div>
<Tag textTransform="uppercase" mr="16px">
uppercase
</Tag>
<Tag fontWeight="bold" mr="16px">
Bold
</Tag>
</div>
);
};
5 changes: 3 additions & 2 deletions packages/pancake-uikit/src/components/Tag/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from "react";
import { SpaceProps } from "styled-system";
import { SpaceProps, TypographyProps } from "styled-system";

export const variants = {
PRIMARY: "primary",
Expand All @@ -20,10 +20,11 @@ export const scales = {
export type Scale = typeof scales[keyof typeof scales];
export type Variant = typeof variants[keyof typeof variants];

export interface TagProps extends SpaceProps {
export interface TagProps extends SpaceProps, TypographyProps {
variant?: Variant;
scale?: Scale;
startIcon?: ReactNode;
endIcon?: ReactNode;
outline?: boolean;
textTransform?: "uppercase" | "lowercase" | "capitalize";
}

0 comments on commit 55ed86b

Please sign in to comment.