Skip to content

Commit

Permalink
feat: add button examples with twin.macro
Browse files Browse the repository at this point in the history
  • Loading branch information
anniehu4 committed Dec 10, 2020
1 parent 87052a7 commit 22a6cbb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/components/src/playground/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { css } from "@linaria/core";
import { styled } from "@linaria/react";
import tw from "twin.macro";

// Temporary props for button to test out css options for variants
type ButtonProps = React.DetailedHTMLProps<
Expand All @@ -13,15 +14,14 @@ type ButtonProps = React.DetailedHTMLProps<
function Button(props: ButtonProps): JSX.Element {
const { variant = "primary", ...rest } = props;
const primary = css`
--color-background: blue;
${tw`bg-blue-300 hover:bg-blue-400`}
`;
const secondary = css`
--color-background: gray;
${tw`bg-gray-600 hover:bg-blue-800`}
`;

const ButtonComponent = styled.button`
color: white;
background-color: var(--color-background);
${tw`font-bold py-2 px-4 rounded text-white`}
`;

return (
Expand Down
11 changes: 11 additions & 0 deletions packages/components/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const tokens = require("@chanzuckerberg/czedi-kit-tokens/json/variables-nested.json");

module.exports = {
theme: {
extend: {
colors: tokens.eds.color,
},
},
variants: {},
plugins: [],
};

0 comments on commit 22a6cbb

Please sign in to comment.