diff --git a/.stylelintrc b/.stylelintrc index 6449c3f..817f362 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -1,6 +1,7 @@ { "extends": "stylelint-config-standard", "rules": { - "indentation": 4 + "indentation": 4, + "font-family-no-missing-generic-family-keyword": null } } diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 1432d9d..7779959 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -8,13 +8,11 @@ interface HeaderProps extends BaseComponentProps { title: string } -export class Header extends React.Component { - render () { - const { title, children, className, style } = this.props +export const Header: React.SFC = props => { + const { title, children, className, style } = props - return
-

{title}

-
{children}
-
- } + return
+

{title}

+
{children}
+
} diff --git a/src/components/Header/style.scss b/src/components/Header/style.scss index 622a0da..02ec140 100644 --- a/src/components/Header/style.scss +++ b/src/components/Header/style.scss @@ -9,7 +9,7 @@ > h1 { flex-shrink: 0; - font-size: 30px; + font-size: 24px; color: $color-primary-dark; font-weight: 500; text-shadow: 0 2px 6px rgba($color: $color-primary-dark, $alpha: 0.4); diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx new file mode 100644 index 0000000..683cc98 --- /dev/null +++ b/src/components/Icon/index.tsx @@ -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 = 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 +} diff --git a/src/components/index.ts b/src/components/index.ts index f887995..3da6434 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1 +1,2 @@ export * from './Header' +export * from './Icon' diff --git a/src/containers/Proxies/index.tsx b/src/containers/Proxies/index.tsx index e46c88d..b859bf5 100644 --- a/src/containers/Proxies/index.tsx +++ b/src/containers/Proxies/index.tsx @@ -1,11 +1,11 @@ import * as React from 'react' -import { Header } from '@components' +import { Header, Icon } from '@components' export default class Proxies extends React.Component<{}, {}> { render () { return
- +
} diff --git a/src/styles/common.scss b/src/styles/common.scss index a1af578..30a6317 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -1,4 +1,5 @@ @import 'variables'; +@import 'iconfont'; // styles initial html { diff --git a/src/styles/iconfont.scss b/src/styles/iconfont.scss new file mode 100644 index 0000000..badc20d --- /dev/null +++ b/src/styles/iconfont.scss @@ -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"; } diff --git a/src/views/Proxies/index.tsx b/src/views/Proxies/index.tsx index 6793a0f..c943363 100644 --- a/src/views/Proxies/index.tsx +++ b/src/views/Proxies/index.tsx @@ -4,11 +4,11 @@ import * as React from 'react' import ProxiesContainer from '@containers/Proxies' import ProxyGroupContainer from '@containers/ProxyGroup' -export default class Proxies extends React.Component<{}, {}> { - render () { - return
- - -
- } -} +const Proxies: React.SFC = () => ( +
+ + +
+) + +export default Proxies