Skip to content

Commit

Permalink
fix: add text support for button component (#58)
Browse files Browse the repository at this point in the history
Use children prop as text to display in button
  • Loading branch information
amalv authored Nov 14, 2019
1 parent c41bd85 commit 0365098
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export default {
title: "Button",
};

export const Default: React.FC = () => <Button />;
export const Default: React.FC = () => <Button>Primary</Button>;
7 changes: 5 additions & 2 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { ThemeProvider, StylesProvider } from "@material-ui/core/styles";
import { BaseButton } from "./Button.styles";
import theme from "../MuiTheme";

export const Button: React.FC = () => (
export interface ButtonProps {
children: React.ReactNode;
}
export const Button: React.FC<ButtonProps> = ({ children }: ButtonProps) => (
<StylesProvider injectFirst>
<ThemeProvider theme={theme}>
<BaseButton backgroundcolor={theme.palette.primary.main}>
Primary
{children}
</BaseButton>
</ThemeProvider>
</StylesProvider>
Expand Down

1 comment on commit 0365098

@vercel
Copy link

@vercel vercel bot commented on 0365098 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.