Day_16 has been added

pull/72/head
asabeneh 4 years ago
parent 479667a74c
commit 2df2d25cb4

@ -99,7 +99,7 @@ const Button = ({ onClick, text, style }) => {
) )
} }
const buttonWithStyles = (CompParam, bgColor = 'default') => { const buttonWithStyles = (CompParam, name = 'default') => {
const colors = [ const colors = [
{ {
name: 'default', name: 'default',
@ -132,7 +132,7 @@ const buttonWithStyles = (CompParam, bgColor = 'default') => {
color: '#ffffff', color: '#ffffff',
}, },
] ]
const { backgroundColor, color } = colors.find((c) => c.name === bgColor) const { backgroundColor, color } = colors.find((c) => c.name === name)
const buttonStyles = { const buttonStyles = {
backgroundColor, backgroundColor,
@ -170,7 +170,7 @@ class App extends Component {
text='Info' text='Info'
onClick={() => alert('I am styled with info color')} onClick={() => alert('I am styled with info color')}
/> />
<SuccessButton text='Success' onClick={() => alert('I am succesful')} /> <SuccessButton text='Success' onClick={() => alert('I am successful')} />
<WarningButton <WarningButton
text='Warning' text='Warning'
onClick={() => alert('I warn you many times')} onClick={() => alert('I warn you many times')}

@ -9,7 +9,7 @@ const Button = ({ onClick, text, style }) => {
) )
} }
const buttonWithStyles = (CompParam, bgColor = 'default') => { const buttonWithStyles = (CompParam, name = 'default') => {
const colors = [ const colors = [
{ {
name: 'default', name: 'default',
@ -42,7 +42,7 @@ const buttonWithStyles = (CompParam, bgColor = 'default') => {
color: '#ffffff', color: '#ffffff',
}, },
] ]
const { backgroundColor, color } = colors.find((c) => c.name === bgColor) const { backgroundColor, color } = colors.find((c) => c.name === name)
const buttonStyles = { const buttonStyles = {
backgroundColor, backgroundColor,
@ -81,7 +81,7 @@ class App extends Component {
text='Info' text='Info'
onClick={() => alert('I am styled with info color')} onClick={() => alert('I am styled with info color')}
/> />
<SuccessButton text='Success' onClick={() => alert('I am succesful')} /> <SuccessButton text='Success' onClick={() => alert('I am successful')} />
<WarningButton <WarningButton
text='Warning' text='Warning'
onClick={() => alert('I warn you many times')} onClick={() => alert('I warn you many times')}

Loading…
Cancel
Save