Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Button component, set the theme colors and fonts #54

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/App.css

This file was deleted.

11 changes: 7 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Button from 'material-ui/Button';
import Button from './components/Button';
import Dialog, {
DialogTitle,
DialogContent,
Expand Down Expand Up @@ -47,7 +47,7 @@ class App extends React.Component {
<DialogContentText>Hello World</DialogContentText>
</DialogContent>
<DialogActions>
<Button color="primary" onClick={this.handleClose}>
<Button type="flat" onClick={this.handleClose}>
OK
</Button>
</DialogActions>
Expand All @@ -58,8 +58,11 @@ class App extends React.Component {
<Typography variant="subheading" gutterBottom>
Showcase App
</Typography>
<Button variant="raised" color="secondary" onClick={this.handleClick}>
Test Popup
<Button type="primary" onClick={this.handleClick}>
Primary
</Button>
<Button type="secondary" onClick={this.handleClick}>
Secondary
</Button>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url('https://fonts.googleapis.com/css?family=Nunito');
@import url('https://fonts.googleapis.com/css?family=Nunito:600,700');
@import './assets/sass/mixins.scss';

body {
Expand Down
4 changes: 2 additions & 2 deletions src/assets/sass/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ $copy: #A3A1AA;
$main: black;

// Font weights
$normal: 500;
$bold: 600;
$normal: 600;
$bold: 700;
35 changes: 35 additions & 0 deletions src/components/Button/Button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@import '../../assets/sass/variables.scss';

.button {
font-weight: 700 !important;
border-radius: 3px !important;
text-transform: capitalize !important;
box-shadow: none !important;

/** Primary Button **/
&.primary {
background: $success !important;
color: #FFFFFF !important;
font-size: 20px !important;
padding: 8px 42px !important;
box-shadow: 0 10px 15px rgba($success, 0.25) !important;

&:hover {
background: darken($success, 15%) !important;
}

&:active {
box-shadow: 0 5px 10px rgba($success, 0.2) !important;
}
}

/** Secondary Button **/
&.secondary {
background: transparent !important;
border: 2px solid $success !important;
font-size: 20px !important;
color: $success !important;
padding: 6px 40px !important;
}

}
26 changes: 26 additions & 0 deletions src/components/Button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import Button from 'material-ui/Button';
import './Button.css';

function CustomButton(props) {
const {
type = 'primary',
onClick,
className = '',
variant = 'flat',
children,
} = props;

return (
<Button
color={type}
variant={variant}
onClick={onClick}
className={`button ${type} ${className}`}
>
{ children ? children : 'Button' }
</Button>
)
}

export default CustomButton;
19 changes: 11 additions & 8 deletions src/withRoot.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import purple from 'material-ui/colors/purple';
import green from 'material-ui/colors/green';
import CssBaseline from 'material-ui/CssBaseline';

// A theme with custom primary and secondary color.
// It's optional.
const theme = createMuiTheme({
typography: {
fontFamily: 'Nunito',
fontWeightRegular: 600,
fontWeightMedium: 700
},
palette: {
primary: {
light: purple[300],
main: purple[500],
dark: purple[700],
main: '#4E4674',
},
secondary: {
light: green[300],
main: green[500],
dark: green[700],
main: '#42F062',
contrastText: '#FFFFFF'
},
error: {
main: '#FF5757'
}
},
});

Expand Down