-
Notifications
You must be signed in to change notification settings - Fork 30
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
1206cb4
4c29cc8
c25f562
890ab43
fbf317b
05dcd5e
312ce78
b0e78cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
@import url("https://fonts.googleapis.com/css?family=Nunito:600,700"); | ||
body { | ||
font-family: 'Nunito', sans-serif; } | ||
|
||
.App { | ||
text-align: center; | ||
} | ||
text-align: center; } | ||
|
||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
height: 80px; | ||
} | ||
height: 80px; } | ||
|
||
.App-header { | ||
background-color: #222; | ||
height: 150px; | ||
padding: 20px; | ||
color: white; | ||
} | ||
color: white; } | ||
|
||
.App-title { | ||
font-size: 1.5em; | ||
} | ||
font-size: 1.5em; } | ||
|
||
.App-intro { | ||
font-size: large; | ||
} | ||
font-size: large; } | ||
|
||
@keyframes App-logo-spin { | ||
from { transform: rotate(0deg); } | ||
to { transform: rotate(360deg); } | ||
} | ||
from { | ||
transform: rotate(0deg); } | ||
to { | ||
transform: rotate(360deg); } } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
import { withStyles } from 'material-ui/styles'; | ||
import Button from 'material-ui/Button'; | ||
|
||
const styles = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a I understand that some of you have seen a few codes where people just write CSS in JS and that works most of the time. |
||
primary: { | ||
background: 'rgb(66, 240, 98)', | ||
borderRadius: 3, | ||
border: 0, | ||
color: '#FFFFFF', | ||
fontWeight: 700, | ||
fontSize: 20, | ||
textTransform: 'capitalize', | ||
padding: '8px 42px', | ||
boxShadow: '0 10px 15px rgba(66, 240, 98, 0.25)', | ||
'&:hover': { | ||
background: 'rgb(52, 198, 79)' | ||
}, | ||
'&:active': { | ||
boxShadow: '0 5px 10px rgba(66, 240, 98, 0.2)', | ||
} | ||
}, | ||
secondary: { | ||
background: 'transparent', | ||
borderRadius: 3, | ||
border: '2px solid #42F062', | ||
fontSize: 20, | ||
textTransform: 'capitalize', | ||
padding: '6px 40px', | ||
}, | ||
default: { | ||
textTransform: 'capitalize', | ||
} | ||
}; | ||
|
||
function CustomButton(props) { | ||
if (props.type === 'primary' || !props.type) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Productivity hack with react: Use destructuring.
|
||
return ( | ||
<Button | ||
variant="raised" | ||
color="secondary" | ||
onClick={props.onClick} | ||
className={props.classes.primary+' '+props.className} | ||
> | ||
{props.children ? props.children : 'Button'} | ||
</Button> | ||
); | ||
} | ||
else if (props.type === 'secondary') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't even need these conditions 😄
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing this out. I completely forgot about ES6 power 😉 |
||
return ( | ||
<Button | ||
color="secondary" | ||
onClick={props.onClick} | ||
className={props.classes.secondary+' '+props.className} | ||
> | ||
{props.children ? props.children : 'Button'} | ||
</Button> | ||
); | ||
} | ||
else if (props.type === 'flat') { | ||
return ( | ||
<Button | ||
color="primary" | ||
className={props.classes.default+' '+props.className} | ||
onClick={props.onClick} | ||
> | ||
{props.children ? props.children : 'Button'} | ||
</Button> | ||
) | ||
} | ||
} | ||
|
||
export default withStyles(styles)(CustomButton); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a saying in the UI world.
Manners may maketh a man, but it's indentation which makes a developer!
Indent properly, move the brackets to proper places and not just your end product, but your code will look beautiful as well! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for this problem, but I think that was due to parsing the App.scss file. I will see if I can fix it though 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@divyamrastogi Sorry, I cannot fix this, since this is happening with every SCSS file being converted into CSS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Everyone was facing that issue. I've added App.css to
.gitignore
now. Just take a pull from master and you won't have to commit yourApp.css
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@divyamrastogi No, it isn't getting ignored. I think you should change it to
src/App.css