diff --git a/src/components/Header/style.scss b/src/components/Header/style.scss index 64b502f..d812edc 100644 --- a/src/components/Header/style.scss +++ b/src/components/Header/style.scss @@ -23,3 +23,9 @@ display: flex; align-items: center; } + +@media (max-width: 768px) { + .header > h1 { + font-size: 20px; + } +} diff --git a/src/components/Modal/style.scss b/src/components/Modal/style.scss index ba68aa4..66cedff 100644 --- a/src/components/Modal/style.scss +++ b/src/components/Modal/style.scss @@ -3,6 +3,9 @@ $width: 400px; $bigWidth: 600px; +$mobileWidth: 280px; +$mobileBigWidth: 480px; + .modal-mask { position: fixed; top: 0; @@ -76,3 +79,15 @@ $bigWidth: 600px; transform: scale(1); } } + +@media (max-width: 768px) { + .modal-mask { + .modal-small { + width: $mobileWidth; + } + + .modal-big { + width: $mobileBigWidth; + } + } +} diff --git a/src/containers/App.tsx b/src/containers/App.tsx index 99779a8..cfcbab4 100644 --- a/src/containers/App.tsx +++ b/src/containers/App.tsx @@ -28,12 +28,12 @@ export default class App extends React.Component { // { path: '/', name: 'Overview', component: Overview, exact: true }, { path: '/proxies', name: 'Proxies', component: Proxies }, { path: '/logs', name: 'Logs', component: Logs }, - { path: '/rules', name: 'Rules', component: Rules }, + { path: '/rules', name: 'Rules', component: Rules, noMobile: true }, { path: '/settings', name: 'Settings', component: Settings } ] return ( -
+
}/> diff --git a/src/containers/ExternalControllerDrawer/style.scss b/src/containers/ExternalControllerDrawer/style.scss index 02424c9..747cca8 100644 --- a/src/containers/ExternalControllerDrawer/style.scss +++ b/src/containers/ExternalControllerDrawer/style.scss @@ -20,3 +20,31 @@ font-weight: bold; } } + +@media (max-width: 768px) { + .external-controller { + // hack + .row { + flex-direction: column; + align-items: flex-start; + } + + .title { + margin: 5px 0; + } + + .form { + margin: 5px 0; + } + + // hack + .column { + width: 100%; + } + + // hack + .alert { + display: none; + } + } +} diff --git a/src/containers/Proxies/components/Group/style.scss b/src/containers/Proxies/components/Group/style.scss index 62dd76f..e4c55eb 100644 --- a/src/containers/Proxies/components/Group/style.scss +++ b/src/containers/Proxies/components/Group/style.scss @@ -16,6 +16,7 @@ .proxy-group-name { overflow: hidden; text-overflow: ellipsis; + white-space: nowrap; padding: 0 20px; width: 120px; } @@ -51,3 +52,32 @@ flex: 1; margin-left: 30px; } + +@media (max-width: 768px) { + .proxy-group { + flex-direction: column; + } + + .proxy-group-name { + width: 140px; + } + + .proxy-group-part { + width: 100%; + height: 42px; + margin-top: 6px; + justify-content: space-between; + } + + .proxy-group-type { + margin-right: 20px; + } + + .proxy-group-tags-container { + padding: 5px 0 10px; + } + + .proxy-group-tags { + margin-left: 20px; + } +} diff --git a/src/containers/Proxies/components/Proxy/style.scss b/src/containers/Proxies/components/Proxy/style.scss index 36b1116..178e9d4 100644 --- a/src/containers/Proxies/components/Proxy/style.scss +++ b/src/containers/Proxies/components/Proxy/style.scss @@ -64,3 +64,20 @@ background-color: $color-gray-darken; } } + +@media (max-width: 768px) { + .proxy-item { + $height: 70px; + + height: $height; + + .proxy-delay { + left: unset; + bottom: unset; + top: 0; + right: 20px; + height: $height; + line-height: $height; + } + } +} diff --git a/src/containers/Proxies/style.scss b/src/containers/Proxies/style.scss index 0a6361e..054de17 100644 --- a/src/containers/Proxies/style.scss +++ b/src/containers/Proxies/style.scss @@ -37,10 +37,6 @@ } @include response(xxs) { - --columns: 4; - } - - @include response(tiny) { --columns: 3; } @@ -68,3 +64,22 @@ text-shadow: 0 2px 6px rgba($color: $color-primary-dark, $alpha: 0.4); cursor: pointer; } + +@media (max-width: 768px) { + .proxies-group-card { + margin: 12px 0; + } + + .proxies-list { + margin-right: 0; + padding-bottom: 20px; + flex-wrap: unset; + flex-direction: column; + + > li { + width: 100%; + margin-right: 0; + margin-bottom: 10px; + } + } +} diff --git a/src/containers/Settings/index.tsx b/src/containers/Settings/index.tsx index a125c66..ab81ab3 100644 --- a/src/containers/Settings/index.tsx +++ b/src/containers/Settings/index.tsx @@ -112,85 +112,101 @@ class Settings extends React.Component {
- - {t('labels.startAtLogin')} + + + {t('labels.startAtLogin')} + + + + - - - - - {t('labels.language')} - - - + + + {t('labels.language')} + + + + - - {t('labels.setAsSystemProxy')} + + + {t('labels.setAsSystemProxy')} + + + + - - - - - {t('labels.allowConnectFromLan')} - - - + + + {t('labels.allowConnectFromLan')} + + + + - - {t('labels.proxyMode')} + + + {t('labels.proxyMode')} + + + + - - - - - {t('labels.socks5ProxyPort')} - - - this.setState({ socks5ProxyPort: parseInt(socks5ProxyPort, 10) })} - onBlur={this.handleSocksPortSave} - /> + + + {t('labels.socks5ProxyPort')} + + + this.setState({ socks5ProxyPort: parseInt(socks5ProxyPort, 10) })} + onBlur={this.handleSocksPortSave} + /> + - - {t('labels.httpProxyPort')} + + + {t('labels.httpProxyPort')} + + + this.setState({ httpProxyPort: parseInt(httpProxyPort, 10) })} + onBlur={this.handleHttpPortSave} + /> + - - this.setState({ httpProxyPort: parseInt(httpProxyPort, 10) })} - onBlur={this.handleHttpPortSave} - /> - - - {t('labels.externalController')} - - - {`${externalControllerHost}:${externalControllerPort}`} - this.props.store.setShowAPIModal(true)}> - 修改 - + + + {t('labels.externalController')} + + + {`${externalControllerHost}:${externalControllerPort}`} + this.props.store.setShowAPIModal(true)}> + 修改 + + diff --git a/src/containers/Settings/style.scss b/src/containers/Settings/style.scss index 3b66372..9bc5728 100644 --- a/src/containers/Settings/style.scss +++ b/src/containers/Settings/style.scss @@ -78,3 +78,19 @@ } } } + +@media (max-width: 768px) { + .settings-card { + // hack + .row { + flex-direction: column; + padding-top: 0; + padding-bottom: 0; + + > .column { + width: 100%; + margin: 10px 0; + } + } + } +} diff --git a/src/containers/Sidebar/index.tsx b/src/containers/Sidebar/index.tsx index e2e4f54..a085ced 100644 --- a/src/containers/Sidebar/index.tsx +++ b/src/containers/Sidebar/index.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import { NavLink } from 'react-router-dom' import { translate } from 'react-i18next' +import classnames from 'classnames' import { I18nProps } from '@models' import './style.scss' @@ -10,6 +11,7 @@ interface SidebarProps extends I18nProps { routes: { path: string name: string + noMobile?: boolean exact?: boolean }[] } @@ -23,8 +25,8 @@ class Sidebar extends React.Component {
    { routes.map( - ({ path, name, exact }) => ( -
  • + ({ path, name, exact, noMobile }) => ( +
  • { t(name) }
  • ) diff --git a/src/containers/Sidebar/style.scss b/src/containers/Sidebar/style.scss index dbcb3c2..88be16c 100644 --- a/src/containers/Sidebar/style.scss +++ b/src/containers/Sidebar/style.scss @@ -51,3 +51,46 @@ } } } + +@media (max-width: 768px) { + .sidebar { + width: 100%; + height: 60px; + flex-direction: row; + background: $background; + z-index: 10; + } + + .sidebar-logo { + margin: 0 15px; + width: 36px; + height: 36px; + } + + .sidebar-menu { + flex: 1; + flex-direction: row; + justify-content: center; + margin-top: 0; + overflow-x: scroll; + padding: 10px; + + &::-webkit-scrollbar { + display: none; + } + + .item { + margin-top: 0; + + > a { + width: 80px; + height: 32px; + line-height: 32px; + } + } + + .item.no-mobile { + display: none; + } + } +} diff --git a/src/styles/common.scss b/src/styles/common.scss index db4d1e3..c1ce54f 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -37,8 +37,8 @@ body { padding-left: 150px; } -.app.clash-x { - background: #f4f5f6; +.app.not-clashx { + background: $background; } .page-container { @@ -49,9 +49,7 @@ body { } .page { - padding: 20px 35px; - padding-left: 0; - padding-bottom: 30px; + padding: 20px 35px 30px 0; width: 100%; height: 100vh; margin: 0 auto; @@ -62,3 +60,25 @@ body { .container { margin: 20px 0; } + +@media (max-width: 768px) { + .app { + padding-left: 0; + padding-top: 60px; + } + + .page-container { + width: 100%; + padding: 0 10px; + height: calc(100vh - 60px); + + &::-webkit-scrollbar { + display: none; + } + } + + .page { + padding: 0 0 20px; + height: 100%; + } +} diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 4ef407c..2cd0873 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -3,6 +3,8 @@ * Style Common Variables */ +$background: #f4f5f6; + // primary colors $color-primary: #57befc; $color-primary-dark: #2c8af8; @@ -31,9 +33,6 @@ $color-black: #000; } $breakpoints: ( - 'tiny': ( - max-width: 680px - ), 'xxs': ( max-width: 760px ),