mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 22:11:56 +08:00
Add: component <Icon>
Improve: use SFC
This commit is contained in:
parent
c5fcba3444
commit
2982026060
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "stylelint-config-standard",
|
"extends": "stylelint-config-standard",
|
||||||
"rules": {
|
"rules": {
|
||||||
"indentation": 4
|
"indentation": 4,
|
||||||
|
"font-family-no-missing-generic-family-keyword": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,11 @@ interface HeaderProps extends BaseComponentProps {
|
|||||||
title: string
|
title: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Header extends React.Component<HeaderProps, {}> {
|
export const Header: React.SFC<HeaderProps> = props => {
|
||||||
render () {
|
const { title, children, className, style } = props
|
||||||
const { title, children, className, style } = this.props
|
|
||||||
|
|
||||||
return <header className={classnames('header', className)} style={style}>
|
return <header className={classnames('header', className)} style={style}>
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
<div className="operations">{children}</div>
|
<div className="operations">{children}</div>
|
||||||
</header>
|
</header>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
> h1 {
|
> h1 {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-size: 30px;
|
font-size: 24px;
|
||||||
color: $color-primary-dark;
|
color: $color-primary-dark;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-shadow: 0 2px 6px rgba($color: $color-primary-dark, $alpha: 0.4);
|
text-shadow: 0 2px 6px rgba($color: $color-primary-dark, $alpha: 0.4);
|
||||||
|
20
src/components/Icon/index.tsx
Normal file
20
src/components/Icon/index.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import * as React from 'react'
|
||||||
|
import { BaseComponentProps } from '@models/BaseProps'
|
||||||
|
import classnames from 'classnames'
|
||||||
|
|
||||||
|
interface IconProps extends BaseComponentProps {
|
||||||
|
// icon type
|
||||||
|
type: string
|
||||||
|
|
||||||
|
// icon size
|
||||||
|
size?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Icon: React.SFC<IconProps> = props => {
|
||||||
|
const { type, size = 14, className: cn, style: s } = props
|
||||||
|
const className = classnames('clash-iconfont', `icon-${type}`, cn)
|
||||||
|
const style: React.CSSProperties = { fontSize: size, ...s }
|
||||||
|
const iconProps = { ...props, className, style }
|
||||||
|
|
||||||
|
return <i {...iconProps} />
|
||||||
|
}
|
@ -1 +1,2 @@
|
|||||||
export * from './Header'
|
export * from './Header'
|
||||||
|
export * from './Icon'
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { Header } from '@components'
|
import { Header, Icon } from '@components'
|
||||||
|
|
||||||
export default class Proxies extends React.Component<{}, {}> {
|
export default class Proxies extends React.Component<{}, {}> {
|
||||||
render () {
|
render () {
|
||||||
return <div className="container">
|
return <div className="container">
|
||||||
<Header title="代理" >
|
<Header title="代理" >
|
||||||
|
<Icon type="plus" size={20} style={{ fontWeight: 'bold' }} />
|
||||||
</Header>
|
</Header>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@import 'variables';
|
@import 'variables';
|
||||||
|
@import 'iconfont';
|
||||||
|
|
||||||
// styles initial
|
// styles initial
|
||||||
html {
|
html {
|
||||||
|
37
src/styles/iconfont.scss
Normal file
37
src/styles/iconfont.scss
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Clash Dashboard Iconfont
|
||||||
|
* generated by iconfont.cn
|
||||||
|
*/
|
||||||
|
@import 'variables';
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "clash-iconfont";
|
||||||
|
src: url('//at.alicdn.com/t/font_841708_2viqaiy9h37.ttf') format('truetype');
|
||||||
|
}
|
||||||
|
|
||||||
|
.clash-iconfont {
|
||||||
|
font-family: "clash-iconfont" !important;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: normal;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
color: $color-primary-dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-close::before { content: "\e602"; }
|
||||||
|
|
||||||
|
.icon-info::before { content: "\e603"; }
|
||||||
|
|
||||||
|
.icon-drag::before { content: "\e604"; }
|
||||||
|
|
||||||
|
.icon-down-arrow-o::before { content: "\e605"; }
|
||||||
|
|
||||||
|
.icon-check::before { content: "\e606"; }
|
||||||
|
|
||||||
|
.icon-plus::before { content: "\e607"; }
|
||||||
|
|
||||||
|
.icon-triangle-up::before { content: "\e608"; }
|
||||||
|
|
||||||
|
.icon-triangle-down::before { content: "\e609"; }
|
||||||
|
|
||||||
|
.icon-up-arrow-o::before { content: "\e60a"; }
|
@ -4,11 +4,11 @@ import * as React from 'react'
|
|||||||
import ProxiesContainer from '@containers/Proxies'
|
import ProxiesContainer from '@containers/Proxies'
|
||||||
import ProxyGroupContainer from '@containers/ProxyGroup'
|
import ProxyGroupContainer from '@containers/ProxyGroup'
|
||||||
|
|
||||||
export default class Proxies extends React.Component<{}, {}> {
|
const Proxies: React.SFC = () => (
|
||||||
render () {
|
<div className="page">
|
||||||
return <div className="page">
|
|
||||||
<ProxiesContainer />
|
<ProxiesContainer />
|
||||||
<ProxyGroupContainer />
|
<ProxyGroupContainer />
|
||||||
</div>
|
</div>
|
||||||
}
|
)
|
||||||
}
|
|
||||||
|
export default Proxies
|
||||||
|
Loading…
x
Reference in New Issue
Block a user