Last active
January 28, 2019 09:31
-
-
Save YanceyOfficial/8ea13faf6697e7a4bee1d206acb756f2 to your computer and use it in GitHub Desktop.
[源码] 尝试创建一个React通用UI组件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import Button from './components/Button/Button'; | |
import { useState } from 'react'; | |
import { library } from '@fortawesome/fontawesome-svg-core'; | |
import { | |
faSpinner, | |
faTrashAlt, | |
faSave, | |
} from '@fortawesome/free-solid-svg-icons'; | |
library.add(faSpinner, faTrashAlt, faSave); | |
class App extends Component { | |
render() { | |
return ( | |
<div className='App'> | |
<Button type='default'>default</Button> | |
<Button type='primary'>primary</Button> | |
<Button type='danger'>danger</Button> | |
<Button type='default'>default</Button> | |
<Button type='primary' icon='save'> | |
save | |
</Button> | |
<Button type='danger' icon='trash-alt'> | |
delete | |
</Button> | |
<Button disabled>disabled</Button> | |
<Button>no any props</Button> | |
<Button icon='save' loading> | |
loading | |
</Button> | |
<Example /> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment