Skip to content

Commit

Permalink
feat: add button component (#57)
Browse files Browse the repository at this point in the history
- Add button component
- Add primary button story
  • Loading branch information
amalv committed Nov 14, 2019
1 parent a9da0e6 commit c8faaea
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as React from "react";
import { Button } from "./Button";

export default {
title: "Button",
};

export const Default: React.FC = () => <Button />;
15 changes: 15 additions & 0 deletions src/components/Button.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from "styled-components";
import Button from "@material-ui/core/Button";

interface BaseButtonProps {
textcolor?: string | undefined;
backgroundcolor?: string | undefined;
}

export const BaseButton = styled(Button)<BaseButtonProps>`
background-color: ${({ backgroundcolor }): string => backgroundcolor || "white"};
color: ${({ textcolor }): string => textcolor || "white"};
border-radius: 4px;
width: 112px;
height: 36px;
`;
14 changes: 14 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";
import { ThemeProvider, StylesProvider } from "@material-ui/core/styles";
import { BaseButton } from "./Button.styles";
import theme from "../MuiTheme";

export const Button: React.FC = () => (
<StylesProvider injectFirst>
<ThemeProvider theme={theme}>
<BaseButton backgroundcolor={theme.palette.primary.main}>
Primary
</BaseButton>
</ThemeProvider>
</StylesProvider>
);
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from "./SignInButton";
export * from "./Input";
export * from "./Post";
export * from "./Filters";
export * from "./Button";

1 comment on commit c8faaea

@vercel
Copy link

@vercel vercel bot commented on c8faaea Nov 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.