├── .prettierrc ├── src ├── components │ ├── Spinner │ │ ├── types.ts │ │ ├── index.tsx │ │ ├── index.stories.tsx │ │ └── Spinner.tsx │ ├── Overlay │ │ ├── types.ts │ │ ├── index.tsx │ │ └── Overlay.tsx │ ├── Table │ │ ├── index.tsx │ │ ├── example │ │ │ ├── header.tsx │ │ │ └── const.ts │ │ ├── utils.ts │ │ └── index.stories.tsx │ ├── Flex │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── Flex.tsx │ │ └── index.stories.tsx │ ├── Text │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── Text.tsx │ │ └── index.stories.tsx │ ├── Image │ │ ├── options.ts │ │ ├── index.ts │ │ ├── types.ts │ │ ├── Wrapper.tsx │ │ ├── BackgroundImage.tsx │ │ ├── Image.tsx │ │ └── index.stories.tsx │ ├── Toggle │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── theme.ts │ │ ├── index.stories.tsx │ │ ├── Toggle.tsx │ │ └── StyledToggle.tsx │ ├── Dropdown │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── index.stories.tsx │ │ └── Dropdown.tsx │ ├── Progress │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── ProgressBunnyWrapper.tsx │ │ ├── StyledProgress.tsx │ │ └── Progress.tsx │ ├── Skeleton │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── index.stories.tsx │ │ └── Skeleton.tsx │ ├── Tag │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── Tag.tsx │ │ ├── StyledTag.tsx │ │ └── index.stories.tsx │ ├── Input │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── index.stories.tsx │ │ └── Input.tsx │ ├── Radio │ │ ├── index.tsx │ │ ├── theme.ts │ │ ├── types.ts │ │ ├── index.stories.tsx │ │ └── Radio.tsx │ ├── Breadcrumbs │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── index.stories.tsx │ │ └── Breadcrumbs.tsx │ ├── Layouts │ │ ├── index.tsx │ │ ├── CardsLayout.tsx │ │ ├── BaseLayout.tsx │ │ └── index.stories.tsx │ ├── Checkbox │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── index.stories.tsx │ │ └── Checkbox.tsx │ ├── Heading │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── Heading.tsx │ │ └── index.stories.tsx │ ├── Link │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── LinkExternal.tsx │ │ ├── Link.tsx │ │ └── index.stories.tsx │ ├── Alert │ │ ├── index.tsx │ │ ├── theme.ts │ │ ├── types.ts │ │ └── index.stories.tsx │ ├── ButtonMenu │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── StyledButtonMenu.tsx │ │ ├── ButtonMenu.tsx │ │ └── ButtonMenuItem.tsx │ ├── Button │ │ ├── index.tsx │ │ ├── IconButton.tsx │ │ ├── Button.tsx │ │ └── types.ts │ ├── Svg │ │ ├── types.ts │ │ ├── Icons │ │ │ ├── Minus.tsx │ │ │ ├── ArrowDropDown.tsx │ │ │ ├── ArrowDropUp.tsx │ │ │ ├── Add.tsx │ │ │ ├── ChevronLeft.tsx │ │ │ ├── Checkmark.tsx │ │ │ ├── Block.tsx │ │ │ ├── Remove.tsx │ │ │ ├── ArrowBack.tsx │ │ │ ├── ArrowDown.tsx │ │ │ ├── ChevronUp.tsx │ │ │ ├── ChevronDown.tsx │ │ │ ├── ChevronRight.tsx │ │ │ ├── Info.tsx │ │ │ ├── Error.tsx │ │ │ ├── Copy.tsx │ │ │ ├── ArrowForward.tsx │ │ │ ├── Warning.tsx │ │ │ ├── CheckmarkCircle.tsx │ │ │ ├── Verified.tsx │ │ │ ├── Close.tsx │ │ │ ├── OpenNew.tsx │ │ │ ├── SwapVert.tsx │ │ │ ├── Prize.tsx │ │ │ ├── SyncAlt.tsx │ │ │ ├── Search.tsx │ │ │ ├── AutoRenew.tsx │ │ │ ├── Binance.tsx │ │ │ ├── ProgressBunny.tsx │ │ │ ├── ListView.tsx │ │ │ ├── CardView.tsx │ │ │ ├── Community.tsx │ │ │ ├── Calculate.tsx │ │ │ ├── Help.tsx │ │ │ ├── Cog.tsx │ │ │ └── NoProfileAvatar.tsx │ │ └── Svg.tsx │ └── Card │ │ ├── CardBody.tsx │ │ ├── index.tsx │ │ ├── Card.tsx │ │ ├── CardFooter.tsx │ │ ├── CardHeader.tsx │ │ ├── types.ts │ │ ├── theme.ts │ │ ├── StyledCard.tsx │ │ └── CardRibbon.tsx ├── setupTests.js ├── index.d.ts ├── widgets │ ├── WalletModal │ │ ├── index.tsx │ │ ├── types.ts │ │ ├── useWalletModal.tsx │ │ ├── index.stories.tsx │ │ ├── icons │ │ │ ├── TokenPocket.tsx │ │ │ ├── WalletConnect.tsx │ │ │ └── BinanceChain.tsx │ │ ├── WalletCard.tsx │ │ ├── config.tsx │ │ ├── ConnectModal.tsx │ │ ├── AccountModal.tsx │ │ └── CopyToClipboard.tsx │ ├── Menu │ │ ├── index.ts │ │ ├── theme.ts │ │ ├── MenuButton.tsx │ │ ├── MenuLink.tsx │ │ ├── icons │ │ │ ├── More.tsx │ │ │ ├── Hamburger.tsx │ │ │ ├── Home.tsx │ │ │ ├── Info.tsx │ │ │ ├── HamburgerClose.tsx │ │ │ ├── Trade.tsx │ │ │ ├── Nft.tsx │ │ │ ├── index.ts │ │ │ ├── Groups.tsx │ │ │ ├── Twitter.tsx │ │ │ ├── Language.tsx │ │ │ ├── Pool.tsx │ │ │ ├── Telegram.tsx │ │ │ ├── Ifo.tsx │ │ │ ├── Farm.tsx │ │ │ ├── Moon.tsx │ │ │ ├── Ticket.tsx │ │ │ └── Sun.tsx │ │ ├── UserBlock.tsx │ │ ├── types.ts │ │ ├── Panel.tsx │ │ ├── Avatar.tsx │ │ ├── Logo.tsx │ │ ├── MenuEntry.tsx │ │ └── Accordion.tsx │ ├── Modal │ │ ├── types.ts │ │ ├── index.tsx │ │ ├── theme.ts │ │ ├── useModal.ts │ │ └── index.stories.tsx │ └── Toast │ │ ├── index.tsx │ │ ├── ToastAction.tsx │ │ ├── types.ts │ │ └── ToastContainer.tsx ├── hooks │ ├── index.ts │ └── useMatchBreakpoints.stories.tsx ├── util │ ├── getExternalLinkProps.ts │ ├── getThemeValue.ts │ └── getColor.ts ├── styled.d.ts ├── testHelpers.tsx ├── __tests__ │ ├── components │ │ ├── tag.test.tsx │ │ ├── flex.test.tsx │ │ ├── breadcrumbs.test.tsx │ │ ├── overlay.test.tsx │ │ ├── text.test.tsx │ │ ├── button.test.tsx │ │ ├── heading.test.tsx │ │ ├── radio.test.tsx │ │ ├── progress.test.tsx │ │ ├── checkbox.test.tsx │ │ ├── input.test.tsx │ │ ├── dropdown.test.tsx │ │ ├── toggle.test.tsx │ │ ├── layouts.test.tsx │ │ ├── card.test.tsx │ │ ├── buttonmenu.test.tsx │ │ ├── svg.test.tsx │ │ ├── skeleton.test.tsx │ │ ├── alert.test.tsx │ │ └── link.test.tsx │ └── widgets │ │ └── modal.test.tsx ├── theme │ ├── dark.ts │ ├── light.ts │ ├── index.ts │ ├── types.ts │ ├── colors.ts │ └── base.ts └── index.ts ├── babel.config.js ├── .storybook ├── preview-head.html ├── main.js └── preview.js ├── jest.config.js ├── .github ├── CODEOWNERS ├── workflows │ ├── test.yml │ ├── build.yml │ ├── lint.yml │ └── deploy-storybook.yml └── pull_request_template.md ├── rollup.config.js ├── .commitlintrc.json ├── .gitignore ├── .eslintrc ├── tsconfig.json ├── README.md └── CONTRIBUTING.md /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120 3 | } 4 | -------------------------------------------------------------------------------- /src/components/Spinner/types.ts: -------------------------------------------------------------------------------- 1 | export interface SpinnerProps { 2 | size?: number; 3 | } 4 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | import "@testing-library/jest-dom"; 2 | import "jest-styled-components"; 3 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.svg" { 2 | const content: string; 3 | export default content; 4 | } 5 | -------------------------------------------------------------------------------- /src/components/Overlay/types.ts: -------------------------------------------------------------------------------- 1 | export type OverlayProps = { 2 | show: boolean; 3 | zIndex?: number; 4 | }; 5 | -------------------------------------------------------------------------------- /src/components/Table/index.tsx: -------------------------------------------------------------------------------- 1 | export * from "./hooks"; 2 | export * from "./types"; 3 | export * from "./utils"; 4 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@babel/preset-env"], 3 | plugins: ["styled-components"], 4 | }; 5 | -------------------------------------------------------------------------------- /src/components/Flex/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Flex } from "./Flex"; 2 | export type { FlexProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Text/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Text } from "./Text"; 2 | export type { TextProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Image/options.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | root: null, 3 | rootMargin: "200px", 4 | threshold: 0, 5 | }; 6 | -------------------------------------------------------------------------------- /src/components/Overlay/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Overlay } from "./Overlay"; 2 | export type { OverlayProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Spinner/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Spinner } from "./Spinner"; 2 | export type { SpinnerProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Toggle/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Toggle } from "./Toggle"; 2 | export type { ToggleProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Dropdown/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Dropdown } from "./Dropdown"; 2 | export type { DropdownProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Progress/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Progress } from "./Progress"; 2 | export type { ProgressProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Skeleton/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Skeleton } from "./Skeleton"; 2 | export type { SkeletonProps } from "./types"; 3 | -------------------------------------------------------------------------------- /.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/components/Tag/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Tag } from "./Tag"; 2 | export type { TagProps, Variants as TagVariants } from "./types"; 3 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | testPathIgnorePatterns: ["/node_modules/", "/dist/", "/.storybook/"], 4 | }; 5 | -------------------------------------------------------------------------------- /src/components/Image/index.ts: -------------------------------------------------------------------------------- 1 | export { default as BackgroundImage } from "./BackgroundImage"; 2 | export { default as Image } from "./Image"; 3 | -------------------------------------------------------------------------------- /src/components/Input/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Input } from "./Input"; 2 | export type { InputProps, Scales as InputScales } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Radio/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Radio } from "./Radio"; 2 | export type { RadioProps, Scales as RadioScales } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Breadcrumbs/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Breadcrumbs } from "./Breadcrumbs"; 2 | export type { BreadcrumbsProps } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Layouts/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as BaseLayout } from "./BaseLayout"; 2 | export { default as CardsLayout } from "./CardsLayout"; 3 | -------------------------------------------------------------------------------- /src/widgets/WalletModal/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as useWalletModal } from "./useWalletModal"; 2 | export type { ConnectorId, Login } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Checkbox/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Checkbox } from "./Checkbox"; 2 | export type { CheckboxProps, Scales as CheckboxScales } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Flex/types.ts: -------------------------------------------------------------------------------- 1 | import { FlexboxProps, SpaceProps } from "styled-system"; 2 | 3 | export interface FlexProps extends FlexboxProps, SpaceProps {} 4 | -------------------------------------------------------------------------------- /src/components/Progress/types.ts: -------------------------------------------------------------------------------- 1 | export interface ProgressProps { 2 | primaryStep?: number; 3 | secondaryStep?: number; 4 | showProgressBunny?: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /src/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useMatchBreakpoints } from "./useMatchBreakpoints"; 2 | export { default as useParticleBurst } from "./useParticleBurst"; 3 | -------------------------------------------------------------------------------- /src/components/Heading/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Heading } from "./Heading"; 2 | export type { HeadingProps, Sizes as HeadingSizes, Tags as HeadingTags } from "./types"; 3 | -------------------------------------------------------------------------------- /src/components/Link/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Link } from "./Link"; 2 | export { default as LinkExternal } from "./LinkExternal"; 3 | export type { LinkProps } from "./types"; 4 | -------------------------------------------------------------------------------- /src/components/Breadcrumbs/types.ts: -------------------------------------------------------------------------------- 1 | import { SpaceProps } from "styled-system"; 2 | 3 | export interface BreadcrumbsProps extends SpaceProps { 4 | separator?: React.ReactNode; 5 | } 6 | -------------------------------------------------------------------------------- /src/widgets/Menu/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Menu } from "./Menu"; 2 | export { links as menuConfig } from "./config"; 3 | export type { NavProps, LangType, MenuEntry } from "./types"; 4 | -------------------------------------------------------------------------------- /src/components/Alert/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Alert } from "./Alert"; 2 | export { variants as alertVariants } from "./types"; 3 | export type { AlertProps, Variants as AlertVariants } from "./types"; 4 | -------------------------------------------------------------------------------- /src/util/getExternalLinkProps.ts: -------------------------------------------------------------------------------- 1 | const getExternalLinkProps = (): { target: string; rel: string } => ({ 2 | target: "_blank", 3 | rel: "noreferrer noopener", 4 | }); 5 | 6 | export default getExternalLinkProps; 7 | -------------------------------------------------------------------------------- /src/widgets/Modal/types.ts: -------------------------------------------------------------------------------- 1 | export interface ModalTheme { 2 | background: string; 3 | } 4 | 5 | export type Handler = () => void; 6 | 7 | export interface InjectedProps { 8 | onDismiss?: Handler; 9 | } 10 | -------------------------------------------------------------------------------- /src/widgets/Toast/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as ToastContainer } from "./ToastContainer"; 2 | export { types as toastTypes } from "./types"; 3 | export type { ToastContainerProps, Toast, Types as ToastTypes } from "./types"; 4 | -------------------------------------------------------------------------------- /src/components/ButtonMenu/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as ButtonMenu } from "./ButtonMenu"; 2 | export { default as ButtonMenuItem } from "./ButtonMenuItem"; 3 | export type { ButtonMenuProps, ButtonMenuItemProps } from "./types"; 4 | -------------------------------------------------------------------------------- /src/components/Toggle/types.ts: -------------------------------------------------------------------------------- 1 | import { InputHTMLAttributes } from "react"; 2 | 3 | export type ToggleTheme = { 4 | handleBackground: string; 5 | }; 6 | 7 | export type ToggleProps = InputHTMLAttributes; 8 | -------------------------------------------------------------------------------- /src/components/Button/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Button } from "./Button"; 2 | export { default as IconButton } from "./IconButton"; 3 | export type { ButtonProps, Sizes as ButtonSizes, Variants as ButtonVariants } from "./types"; 4 | -------------------------------------------------------------------------------- /src/components/Link/types.ts: -------------------------------------------------------------------------------- 1 | import { AnchorHTMLAttributes } from "react"; 2 | import { TextProps } from "../Text"; 3 | 4 | export interface LinkProps extends TextProps, AnchorHTMLAttributes { 5 | external?: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/components/Checkbox/types.ts: -------------------------------------------------------------------------------- 1 | export const scales = { 2 | SM: "sm", 3 | MD: "md", 4 | } as const; 5 | 6 | export type Scales = typeof scales[keyof typeof scales]; 7 | 8 | export interface CheckboxProps { 9 | scale?: Scales; 10 | } 11 | -------------------------------------------------------------------------------- /src/styled.d.ts: -------------------------------------------------------------------------------- 1 | import "styled-components"; 2 | import { PancakeTheme } from "./theme"; 3 | 4 | declare module "styled-components" { 5 | /* eslint-disable @typescript-eslint/no-empty-interface */ 6 | export interface DefaultTheme extends PancakeTheme {} 7 | } 8 | -------------------------------------------------------------------------------- /src/widgets/Modal/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Modal } from "./Modal"; 2 | export { default as ModalProvider } from "./ModalContext"; 3 | export { default as useModal } from "./useModal"; 4 | export type { InjectedProps as InjectedModalProps } from "./types"; 5 | -------------------------------------------------------------------------------- /src/components/Dropdown/types.ts: -------------------------------------------------------------------------------- 1 | export type Position = "top" | "top-right" | "bottom"; 2 | 3 | export interface PositionProps { 4 | position?: Position; 5 | } 6 | 7 | export interface DropdownProps extends PositionProps { 8 | target: React.ReactElement; 9 | } 10 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence, 3 | # @global-owner1 and @global-owner2 will be requested for 4 | # review when someone opens a pull request. 5 | * @RabbitDoge @hachiojidev 6 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: push 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2 8 | - name: Install modules 9 | run: yarn 10 | - name: Run Jest tests 11 | run: yarn test -------------------------------------------------------------------------------- /src/util/getThemeValue.ts: -------------------------------------------------------------------------------- 1 | import get from "lodash/get"; 2 | import { DefaultTheme } from "styled-components"; 3 | 4 | const getThemeValue = (path: string, fallback?: string | number) => (theme: DefaultTheme): string => 5 | get(theme, path, fallback); 6 | 7 | export default getThemeValue; 8 | -------------------------------------------------------------------------------- /src/util/getColor.ts: -------------------------------------------------------------------------------- 1 | import { DefaultTheme } from "styled-components"; 2 | import getThemeValue from "./getThemeValue"; 3 | 4 | const getColor = (color: string, theme: DefaultTheme): string => { 5 | return getThemeValue(`colors.${color}`, color)(theme); 6 | }; 7 | 8 | export default getColor; 9 | -------------------------------------------------------------------------------- /src/components/Text/types.ts: -------------------------------------------------------------------------------- 1 | import { SpaceProps } from "styled-system"; 2 | 3 | export interface TextProps extends SpaceProps { 4 | color?: string; 5 | fontSize?: string; 6 | bold?: boolean; 7 | small?: boolean; 8 | textTransform?: "uppercase" | "lowercase" | "capitalize"; 9 | } 10 | -------------------------------------------------------------------------------- /src/components/Flex/Flex.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import { flexbox, space } from "styled-system"; 3 | import { FlexProps } from "./types"; 4 | 5 | const Flex = styled.div` 6 | display: flex; 7 | ${flexbox} 8 | ${space} 9 | `; 10 | 11 | export default Flex; 12 | -------------------------------------------------------------------------------- /src/components/Svg/types.ts: -------------------------------------------------------------------------------- 1 | import { SVGAttributes } from "react"; 2 | import { DefaultTheme } from "styled-components"; 3 | import { SpaceProps } from "styled-system"; 4 | 5 | export interface SvgProps extends SVGAttributes, SpaceProps { 6 | theme?: DefaultTheme; 7 | spin?: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /src/widgets/Modal/theme.ts: -------------------------------------------------------------------------------- 1 | import { darkColors, lightColors } from "../../theme/colors"; 2 | import { ModalTheme } from "./types"; 3 | 4 | export const light: ModalTheme = { 5 | background: lightColors.card, 6 | }; 7 | 8 | export const dark: ModalTheme = { 9 | background: darkColors.card, 10 | }; 11 | -------------------------------------------------------------------------------- /src/components/Alert/theme.ts: -------------------------------------------------------------------------------- 1 | import { darkColors, lightColors } from "../../theme/colors"; 2 | import { AlertTheme } from "./types"; 3 | 4 | export const light: AlertTheme = { 5 | background: lightColors.card, 6 | }; 7 | 8 | export const dark: AlertTheme = { 9 | background: darkColors.card, 10 | }; 11 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import typescript from "@rollup/plugin-typescript"; 2 | import pkg from "./package.json"; 3 | 4 | export default { 5 | input: "src/index.ts", 6 | output: [ 7 | { file: pkg.main, format: "cjs" }, 8 | { file: pkg.module, format: "es" }, 9 | ], 10 | plugins: [typescript()], 11 | }; 12 | -------------------------------------------------------------------------------- /src/components/Image/types.ts: -------------------------------------------------------------------------------- 1 | import { SpaceProps } from "styled-system"; 2 | 3 | export interface ContainerProps { 4 | width: number; 5 | height: number; 6 | responsive?: boolean; 7 | } 8 | 9 | export interface ImageProps extends ContainerProps, SpaceProps { 10 | src: string; 11 | alt?: string; 12 | } 13 | -------------------------------------------------------------------------------- /src/components/Radio/theme.ts: -------------------------------------------------------------------------------- 1 | import { darkColors, lightColors } from "../../theme/colors"; 2 | import { RadioTheme } from "./types"; 3 | 4 | export const light: RadioTheme = { 5 | handleBackground: lightColors.card, 6 | }; 7 | 8 | export const dark: RadioTheme = { 9 | handleBackground: darkColors.card, 10 | }; 11 | -------------------------------------------------------------------------------- /src/components/Spinner/index.stories.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Spinner from "./Spinner"; 3 | 4 | export default { 5 | title: "Components/Spinner", 6 | component: Spinner, 7 | argTypes: {}, 8 | }; 9 | 10 | export const Default: React.FC = () => { 11 | return ; 12 | }; 13 | -------------------------------------------------------------------------------- /src/components/Toggle/theme.ts: -------------------------------------------------------------------------------- 1 | import { darkColors, lightColors } from "../../theme/colors"; 2 | import { ToggleTheme } from "./types"; 3 | 4 | export const light: ToggleTheme = { 5 | handleBackground: lightColors.card, 6 | }; 7 | 8 | export const dark: ToggleTheme = { 9 | handleBackground: darkColors.card, 10 | }; 11 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-conventional"], 3 | "rules": { 4 | "subject-case": [2, "always", "sentence-case"], 5 | "type-enum": [ 6 | 2, 7 | "always", 8 | ["build", "ci", "chore", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"] 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | [ ] Before opening a pull request, please read the [contributing guidelines](https://github.com/pancakeswap/pancake-uikit/blob/master/CONTRIBUTING.md) first 2 | [ ] If your PR is work in progress, open it as `draft` 3 | [ ] Before requesting a review, all the checks need to pass 4 | [ ] Explain what your PR does 5 | -------------------------------------------------------------------------------- /src/components/Button/IconButton.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import Button from "./Button"; 3 | import { ButtonProps } from "./types"; 4 | 5 | const IconButton = styled(Button)` 6 | padding: 0; 7 | width: ${({ size }) => (size === "sm" ? "32px" : "48px")}; 8 | `; 9 | 10 | export default IconButton; 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /dist 11 | /storybook-static 12 | 13 | # misc 14 | .DS_Store 15 | 16 | # debug 17 | npm-debug.log* 18 | yarn-debug.log* 19 | yarn-error.log* 20 | -------------------------------------------------------------------------------- /src/components/Card/CardBody.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import { space, SpaceProps } from "styled-system"; 3 | 4 | export type CardBodyProps = SpaceProps; 5 | 6 | const CardBody = styled.div` 7 | ${space} 8 | `; 9 | 10 | CardBody.defaultProps = { 11 | p: "24px", 12 | }; 13 | 14 | export default CardBody; 15 | -------------------------------------------------------------------------------- /src/widgets/Menu/theme.ts: -------------------------------------------------------------------------------- 1 | import { darkColors, lightColors } from "../../theme/colors"; 2 | import { NavTheme } from "./types"; 3 | 4 | export const light: NavTheme = { 5 | background: lightColors.card, 6 | hover: "#EEEAF4", 7 | }; 8 | 9 | export const dark: NavTheme = { 10 | background: darkColors.card, 11 | hover: "#473d5d", 12 | }; 13 | -------------------------------------------------------------------------------- /src/components/Card/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Card } from "./Card"; 2 | export { default as CardBody } from "./CardBody"; 3 | export { default as CardHeader } from "./CardHeader"; 4 | export { default as CardFooter } from "./CardFooter"; 5 | export { default as CardRibbon } from "./CardRibbon"; 6 | export type { CardProps, CardRibbonProps } from "./types"; 7 | -------------------------------------------------------------------------------- /src/components/Progress/ProgressBunnyWrapper.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | const ProgressBunnyWrapper = styled.div` 4 | display: flex; 5 | z-index: 2; 6 | top: -65%; 7 | position: absolute; 8 | transform: translate(-50%, -50%); 9 | transition: left 200ms ease-out; 10 | `; 11 | 12 | export default ProgressBunnyWrapper; 13 | -------------------------------------------------------------------------------- /src/components/Layouts/CardsLayout.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import BaseLayout from "./BaseLayout"; 3 | 4 | const GridLayout = styled(BaseLayout)` 5 | & > div { 6 | grid-column: span 6; 7 | ${({ theme }) => theme.mediaQueries.sm} { 8 | grid-column: span 4; 9 | } 10 | } 11 | `; 12 | 13 | export default GridLayout; 14 | -------------------------------------------------------------------------------- /src/components/Card/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import StyledCard from "./StyledCard"; 3 | import { CardProps } from "./types"; 4 | 5 | const Card: React.FC = ({ ribbon, children, ...props }) => { 6 | return ( 7 | 8 | {ribbon} 9 | {children} 10 | 11 | ); 12 | }; 13 | export default Card; 14 | -------------------------------------------------------------------------------- /src/components/Input/types.ts: -------------------------------------------------------------------------------- 1 | import { SpaceProps } from "styled-system"; 2 | 3 | export const scales = { 4 | SM: "sm", 5 | MD: "md", 6 | LG: "lg", 7 | } as const; 8 | 9 | export type Scales = typeof scales[keyof typeof scales]; 10 | 11 | export interface InputProps extends SpaceProps { 12 | scale?: Scales; 13 | isSuccess?: boolean; 14 | isWarning?: boolean; 15 | } 16 | -------------------------------------------------------------------------------- /src/components/Radio/types.ts: -------------------------------------------------------------------------------- 1 | import { SpaceProps } from "styled-system"; 2 | 3 | export type RadioTheme = { 4 | handleBackground: string; 5 | }; 6 | 7 | export const scales = { 8 | SM: "sm", 9 | MD: "md", 10 | } as const; 11 | 12 | export type Scales = typeof scales[keyof typeof scales]; 13 | 14 | export interface RadioProps extends SpaceProps { 15 | scale?: Scales; 16 | } 17 | -------------------------------------------------------------------------------- /src/widgets/Menu/MenuButton.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import Button from "../../components/Button/Button"; 3 | 4 | const MenuButton = styled(Button)` 5 | color: ${({ theme }) => theme.colors.text}; 6 | padding: 0 8px; 7 | border-radius: 8px; 8 | `; 9 | MenuButton.defaultProps = { 10 | variant: "text", 11 | size: "sm", 12 | }; 13 | 14 | export default MenuButton; 15 | -------------------------------------------------------------------------------- /.storybook/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], 3 | addons: [ 4 | { 5 | name: "@storybook/addon-essentials", 6 | options: { 7 | backgrounds: false, 8 | }, 9 | }, 10 | "@storybook/addon-links", 11 | "@storybook/addon-a11y", 12 | "themeprovider-storybook/register", 13 | ], 14 | }; 15 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@pancakeswap-libs/eslint-config-pancake", 3 | "rules": { 4 | "import/no-extraneous-dependencies": [ 5 | "error", 6 | { 7 | "devDependencies": [ 8 | "src/setupTests.[jt]s?(x)", 9 | "src/testHelpers.[jt]s?(x)", 10 | "**/*.test.[jt]s?(x)", 11 | "rollup.config.js" 12 | ] 13 | } 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/components/Card/CardFooter.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import { space, SpaceProps } from "styled-system"; 3 | 4 | export type CardFooterProps = SpaceProps; 5 | 6 | const CardFooter = styled.div` 7 | border-top: 1px solid ${({ theme }) => theme.colors.borderColor}; 8 | ${space} 9 | `; 10 | 11 | CardFooter.defaultProps = { 12 | p: "24px", 13 | }; 14 | 15 | export default CardFooter; 16 | -------------------------------------------------------------------------------- /src/components/Card/CardHeader.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import { space, SpaceProps } from "styled-system"; 3 | 4 | export type CardHeaderProps = SpaceProps; 5 | 6 | const CardHeader = styled.div` 7 | background: ${({ theme }) => theme.card.cardHeaderBackground}; 8 | 9 | ${space} 10 | `; 11 | 12 | CardHeader.defaultProps = { 13 | p: "24px", 14 | }; 15 | 16 | export default CardHeader; 17 | -------------------------------------------------------------------------------- /src/components/Toggle/index.stories.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import Toggle from "./Toggle"; 3 | 4 | export default { 5 | title: "Components/Toggle", 6 | component: Toggle, 7 | }; 8 | 9 | export const Default: React.FC = () => { 10 | const [isChecked, setIsChecked] = useState(false); 11 | 12 | const toggle = () => setIsChecked(!isChecked); 13 | 14 | return ; 15 | }; 16 | -------------------------------------------------------------------------------- /src/components/ButtonMenu/types.ts: -------------------------------------------------------------------------------- 1 | import { ButtonProps, Sizes, variants } from "../Button/types"; 2 | 3 | export type ButtonMenuItemProps = { 4 | isActive?: boolean; 5 | size?: Sizes; 6 | } & ButtonProps; 7 | 8 | export interface ButtonMenuProps { 9 | variant?: typeof variants.PRIMARY | typeof variants.SUBTLE; 10 | activeIndex?: number; 11 | onClick?: (index: number) => void; 12 | size?: Sizes; 13 | children: React.ReactElement[]; 14 | } 15 | -------------------------------------------------------------------------------- /src/testHelpers.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from "react"; 2 | import { render, RenderResult } from "@testing-library/react"; 3 | import { ThemeProvider } from "styled-components"; 4 | import { light } from "./theme"; 5 | 6 | /* eslint-disable import/prefer-default-export */ 7 | export const renderWithTheme = (component: ReactNode, theme = light): RenderResult => { 8 | return render({component}); 9 | }; 10 | -------------------------------------------------------------------------------- /src/components/Link/LinkExternal.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Link from "./Link"; 3 | import { LinkProps } from "./types"; 4 | import OpenNewIcon from "../Svg/Icons/OpenNew"; 5 | 6 | const LinkExternal: React.FC = ({ children, ...props }) => { 7 | return ( 8 | 9 | {children} 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default LinkExternal; 16 | -------------------------------------------------------------------------------- /src/hooks/useMatchBreakpoints.stories.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import useMatchBreakpoints from "./useMatchBreakpoints"; 3 | 4 | export default { 5 | title: "Hooks/useMatchBreakpoints", 6 | argTypes: {}, 7 | }; 8 | 9 | export const Default: React.FC = () => { 10 | const state = useMatchBreakpoints(); 11 | 12 | return ( 13 |
14 |
{JSON.stringify(state, null, 2)}
15 |
16 | ); 17 | }; 18 | -------------------------------------------------------------------------------- /src/components/Heading/types.ts: -------------------------------------------------------------------------------- 1 | export const tags = { 2 | H1: "h1", 3 | H2: "h2", 4 | H3: "h3", 5 | H4: "h4", 6 | H5: "h5", 7 | H6: "h6", 8 | }; 9 | 10 | export const sizes = { 11 | MD: "md", 12 | LG: "lg", 13 | XL: "xl", 14 | XXL: "xxl", 15 | }; 16 | 17 | export type Tags = typeof tags[keyof typeof tags]; 18 | export type Sizes = typeof sizes[keyof typeof sizes]; 19 | 20 | export interface HeadingProps { 21 | as?: Tags; 22 | size?: Sizes; 23 | } 24 | -------------------------------------------------------------------------------- /src/components/Svg/Icons/Minus.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Svg from "../Svg"; 3 | import { SvgProps } from "../types"; 4 | 5 | const Icon: React.FC = (props) => { 6 | return ( 7 | 8 | 9 | 10 | ); 11 | }; 12 | 13 | export default Icon; 14 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v2 13 | 14 | - name: Setup Node 15 | uses: actions/setup-node@v2.1.2 16 | with: 17 | node-version: 14.x 18 | 19 | - name: Install dependencies 20 | run: yarn install 21 | 22 | - name: Run Build 23 | run: yarn build 24 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | lint: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v2 13 | 14 | - name: Setup Node 15 | uses: actions/setup-node@v2.1.2 16 | with: 17 | node-version: 14.x 18 | 19 | - name: Install dependencies 20 | run: yarn install 21 | 22 | - name: Run ESLint 23 | run: yarn lint 24 | -------------------------------------------------------------------------------- /src/components/Checkbox/index.stories.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Checkbox from "./Checkbox"; 3 | 4 | export default { 5 | title: "Components/Checkbox", 6 | component: Checkbox, 7 | argTypes: {}, 8 | }; 9 | 10 | export const Default: React.FC = () => { 11 | return ( 12 | <> 13 |
14 | 15 |
16 |
17 | 18 |
19 | 20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /src/__tests__/components/tag.test.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { renderWithTheme } from "../../testHelpers"; 3 | import Tag from "../../components/Tag/Tag"; 4 | 5 | it("renders correctly", () => { 6 | const { asFragment } = renderWithTheme(Core); 7 | expect(asFragment()).toMatchInlineSnapshot(` 8 | 9 |
12 | Core 13 |
14 |
15 | `); 16 | }); 17 | -------------------------------------------------------------------------------- /src/__tests__/components/flex.test.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { renderWithTheme } from "../../testHelpers"; 3 | import Flex from "../../components/Flex/Flex"; 4 | 5 | it("renders correctly", () => { 6 | const { asFragment } = renderWithTheme(flex); 7 | expect(asFragment()).toMatchInlineSnapshot(` 8 | 9 |
12 | flex 13 |
14 |
15 | `); 16 | }); 17 | -------------------------------------------------------------------------------- /src/components/Toggle/Toggle.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import StyledToggle, { Input, Handle } from "./StyledToggle"; 3 | import { ToggleProps } from "./types"; 4 | 5 | const Toggle: React.FC = ({ checked, ...props }) => { 6 | const isChecked = !!checked; 7 | 8 | return ( 9 | 10 | 11 | 12 | 13 | ); 14 | }; 15 | 16 | export default Toggle; 17 | -------------------------------------------------------------------------------- /src/__tests__/components/breadcrumbs.test.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { renderWithTheme } from "../../testHelpers"; 3 | import Breadcrumbs from "../../components/Breadcrumbs/Breadcrumbs"; 4 | 5 | it("renders correctly", () => { 6 | const { asFragment } = renderWithTheme(Link); 7 | expect(asFragment()).toMatchInlineSnapshot(` 8 | 9 |
    12 | 13 | `); 14 | }); 15 | -------------------------------------------------------------------------------- /src/components/Svg/Icons/ArrowDropDown.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Svg from "../Svg"; 3 | import { SvgProps } from "../types"; 4 | 5 | const Icon: React.FC = (props) => { 6 | return ( 7 | 8 | 9 | 10 | ); 11 | }; 12 | 13 | export default Icon; 14 | -------------------------------------------------------------------------------- /src/__tests__/components/overlay.test.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { renderWithTheme } from "../../testHelpers"; 3 | import Overlay from "../../components/Overlay/Overlay"; 4 | 5 | it("renders correctly", () => { 6 | const { asFragment } = renderWithTheme(); 7 | expect(asFragment()).toMatchInlineSnapshot(` 8 | 9 |