diff --git a/src/components/Input/index.tsx b/src/components/Input/index.tsx new file mode 100644 index 0000000..0aa3601 --- /dev/null +++ b/src/components/Input/index.tsx @@ -0,0 +1,27 @@ +import * as React from 'react' +import { BaseComponentProps } from '@models/BaseProps' +// import classnames from 'classnames' +import './style.scss' + +interface InputProps extends BaseComponentProps { + value?: string | number + disabled?: boolean + onChange?: (value: string, event?: React.ChangeEvent) => void +} + +export class Input extends React.Component { + static defaultProps: InputProps = { + value: '', + disabled: false, + onChange: () => {} + } + + render() { + const { onChange, value } = this.props + return ( + { + onChange(event.target.value, event) + }} value={value} > + ) + } +} \ No newline at end of file diff --git a/src/components/Input/style.scss b/src/components/Input/style.scss new file mode 100644 index 0000000..6baf50d --- /dev/null +++ b/src/components/Input/style.scss @@ -0,0 +1,21 @@ +@import '~@styles/variables'; + +.input { + display: inline-block; + height: 30px; + width: 100%; + border-radius: 3px; + border: 1px solid $color-primary-lightly; + padding: 4px 11px; + font-size: 14px; + color: $color-primary-darken; + text-align: center; + line-height: 1.5; + transition: all 0.3s; + + &:focus { + outline: 0; + border-color: $color-primary; + box-shadow: 0 2px 10px rgba($color: $color-primary, $alpha: 0.5); + } +} diff --git a/src/components/index.ts b/src/components/index.ts index 8d056f9..8d504d9 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -6,3 +6,4 @@ export * from './Row' export * from './Col' export * from './ButtonSelect' export * from './Tags' +export * from './Input' diff --git a/src/containers/Settings/index.tsx b/src/containers/Settings/index.tsx index ec60523..1e7515a 100644 --- a/src/containers/Settings/index.tsx +++ b/src/containers/Settings/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { Header, Card, Row, Col, Switch, ButtonSelect, ButtonSelectOptions } from '@components' +import { Header, Card, Row, Col, Switch, ButtonSelect, ButtonSelectOptions, Input } from '@components' import { translate } from 'react-i18next' import { I18nProps } from '@i18n' import './style.scss' @@ -10,7 +10,11 @@ class Settings extends React.Component { startAtLogin: false, language: 'en', setAsSystemProxy: true, - allowConnectFromLan: true + allowConnectFromLan: true, + proxyMode: 'rule', + socketProxyPort: 7891, + httpProxyPort: 7890, + externalController: '127.0.0.1:7892' } languageOptions: ButtonSelectOptions[] = [ @@ -18,13 +22,23 @@ class Settings extends React.Component { { label: 'English', value: 'en' } ] + proxyModeOptions: ButtonSelectOptions[] = [ + { label: '全局', value: 'global' }, + { label: '规则', value: 'rule' }, + { label: '直连', value: 'none' } + ] + render () { const { t } = this.props const { startAtLogin, language, setAsSystemProxy, - allowConnectFromLan + allowConnectFromLan, + proxyMode, + socketProxyPort, + httpProxyPort, + externalController, } = this.state return ( @@ -73,6 +87,40 @@ class Settings extends React.Component { + + + + {t('labels.proxyMode')} + + + this.setState({ proxyMode })} + /> + + + {t('labels.socketProxyPort')} + + + this.setState({socketProxyPort})}> + + + + + {t('labels.httpProxyPort')} + + + this.setState({httpProxyPort})}> + + + {t('labels.externalController')} + + + + + + ) }