From 8c841d1418da1d33af83166221318ab995c5b431 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Mon, 26 Apr 2021 18:19:29 +0800 Subject: [PATCH] fix #47 --- .gitignore | 2 +- src/Route.js | 2 +- src/component/OSCNews.module.less | 131 ++++++++++++++++++++++++++++++ src/index.js | 3 +- src/pages/Navigation/index.js | 1 + 5 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 src/component/OSCNews.module.less diff --git a/.gitignore b/.gitignore index 4bb2a4f7..d3113dce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules -oscnews* +oscnews*/ build* dist* diff --git a/src/Route.js b/src/Route.js index ab30c89a..45532941 100644 --- a/src/Route.js +++ b/src/Route.js @@ -1,6 +1,6 @@ import Blank from './pages/Blank'; -import Github from './pages/Github'; +// import Github from './pages/Github'; import Historys from './pages/History'; import Documents from './pages/Document'; import Navigation from './pages/Navigation'; diff --git a/src/component/OSCNews.module.less b/src/component/OSCNews.module.less new file mode 100644 index 00000000..541e0036 --- /dev/null +++ b/src/component/OSCNews.module.less @@ -0,0 +1,131 @@ +.warpper { + height: 100%; + overflow: auto; + :global { + .active { + font-weight: bold; + color: #0e693c; + } + } + .tabs { + flex-direction: row; + display: flex; + padding: 0 10px; + border-bottom: 1px solid #f1f1f1; + div { + padding: 10px 5px; + cursor: pointer; + &:hover { + color: #0e693c; + } + } + } +} + +.newList { + font-size: 14px; + padding: 10px 10px 15px; + :global { + .item { + padding: 8px 5px; + border-bottom: 1px dashed #ececec; + background-color: #fff; + transition: all .3s; + &:hover { + background: #f7f7f7; + .summary:after { + background: linear-gradient(to right, rgba(255, 255, 255, 0), #f7f7f7 96%); + } + } + .title { + font-size: 14px; + line-height: 18px; + text-decoration: none; + font-weight: bold; + color: #333; + display: block; + transition: color .3s; + &:hover { + color: #0e693c; + } + .text-ellipsis { + display: block; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + position: relative; + } + } + .summary { + font-size: 12px; + max-height: 3em; + margin: 8px 0; + color: #a0a0a0; + position: relative; + overflow: hidden; + &:after { + position: absolute; + bottom: 0; + content: ''; + right: 0; + display: block; + width: 160px; + height: 20px; + background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 96%); + } + } + .thumb { + max-width: 150px; + margin-top: -38px; + margin-left: 11px; + position: relative; + z-index: 9; + float: right; + img { + max-height: 40px; + overflow: hidden; + } + } + .from { + a, img, span, svg:not([class~=hide]) { + display: inline-block; + vertical-align: middle; + } + svg { + width: 14px !important; + height: 12px !important; + vertical-align: middle; + path { + fill: #868686; + } + } + .avatar { + overflow: hidden; + display: block; + width: 14px; + min-width: 14px; + max-width: 14px; + height: 14px; + border-radius: 12px; + } + .mr { + margin-right: 15px; + font-size: .75rem; + color: #9d9d9d; + font-weight: normal; + vertical-align: middle; + a { + vertical-align: initial; + color: #a0a0a0; + &:hover { + color: #0e693c; + } + } + } + a { + text-decoration: none; + } + } + } + } +} diff --git a/src/index.js b/src/index.js index b2158f75..7fba6c04 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,3 @@ -import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import Root from './Root'; @@ -75,7 +74,7 @@ storage.get(['oscconfig', 'visible', 'conf', 'dbs', 'todo'], (items) => { if (!items.conf.selectSubType) items.conf.selectSubType = ''; // 为空默认数组第一个 items.storage = storage; - if (!/#normal$/.test(location.hash) && items.conf.isNewTab === false) { + if (!/#normal$/.test(window.location.hash) && items.conf.isNewTab === false) { // eslint-disable-next-line chrome.tabs.update({ url: 'chrome-search://local-ntp/local-ntp.html' }); } else { diff --git a/src/pages/Navigation/index.js b/src/pages/Navigation/index.js index b409422e..cf9191fd 100644 --- a/src/pages/Navigation/index.js +++ b/src/pages/Navigation/index.js @@ -193,6 +193,7 @@ export default class Navigation extends Component { ); })} {navContent.length < 18 && ( + // eslint-disable-next-line jsx-a11y/anchor-is-valid