mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-03-10 16:30:11 +01:00
add selected indicator in list view
This commit is contained in:
parent
687cd8ef1d
commit
237c584363
9
dist/styles/cards.css
vendored
9
dist/styles/cards.css
vendored
@ -75,7 +75,7 @@
|
|||||||
width: calc(100% - 6px);
|
width: calc(100% - 6px);
|
||||||
height: calc(100% - 6px);
|
height: calc(100% - 6px);
|
||||||
border: 1px solid var(--white);
|
border: 1px solid var(--white);
|
||||||
outline: 2px solid #0078d4;
|
outline: 2px solid var(--primary);
|
||||||
}
|
}
|
||||||
.card.hidden::after {
|
.card.hidden::after {
|
||||||
content: "";
|
content: "";
|
||||||
@ -223,6 +223,13 @@
|
|||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
}
|
}
|
||||||
|
.list-card.selected::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
border-left: 2px solid var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
.magazine-card {
|
.magazine-card {
|
||||||
width: 700px;
|
width: 700px;
|
||||||
|
1
dist/styles/global.css
vendored
1
dist/styles/global.css
vendored
@ -16,6 +16,7 @@
|
|||||||
--black: #000;
|
--black: #000;
|
||||||
--white: #fff;
|
--white: #fff;
|
||||||
--whiteConstant: #fff;
|
--whiteConstant: #fff;
|
||||||
|
--primary: #0078d4;
|
||||||
--navHeight: 32px;
|
--navHeight: 32px;
|
||||||
|
|
||||||
--blur-0: saturate(150%) blur(16px);
|
--blur-0: saturate(150%) blur(16px);
|
||||||
|
@ -11,6 +11,7 @@ export namespace Card {
|
|||||||
item: RSSItem
|
item: RSSItem
|
||||||
source: RSSSource
|
source: RSSSource
|
||||||
filter: FeedFilter
|
filter: FeedFilter
|
||||||
|
selected?: boolean
|
||||||
viewConfigs?: ViewConfigs
|
viewConfigs?: ViewConfigs
|
||||||
shortcuts: (item: RSSItem, e: KeyboardEvent) => void
|
shortcuts: (item: RSSItem, e: KeyboardEvent) => void
|
||||||
markRead: (item: RSSItem) => void
|
markRead: (item: RSSItem) => void
|
||||||
|
@ -7,6 +7,7 @@ import { ViewConfigs } from "../../schema-types"
|
|||||||
const className = (props: Card.Props) => {
|
const className = (props: Card.Props) => {
|
||||||
let cn = ["card", "list-card"]
|
let cn = ["card", "list-card"]
|
||||||
if (props.item.hidden) cn.push("hidden")
|
if (props.item.hidden) cn.push("hidden")
|
||||||
|
if (props.selected) cn.push("selected")
|
||||||
return cn.join(" ")
|
return cn.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ export type FeedProps = FeedReduxProps & {
|
|||||||
viewType: ViewType
|
viewType: ViewType
|
||||||
viewConfigs?: ViewConfigs
|
viewConfigs?: ViewConfigs
|
||||||
items: RSSItem[]
|
items: RSSItem[]
|
||||||
|
currentItem: string
|
||||||
sourceMap: Object
|
sourceMap: Object
|
||||||
filter: FeedFilter
|
filter: FeedFilter
|
||||||
shortcuts: (item: RSSItem, e: KeyboardEvent) => void
|
shortcuts: (item: RSSItem, e: KeyboardEvent) => void
|
||||||
|
@ -8,6 +8,7 @@ import { ViewType } from "../../schema-types";
|
|||||||
import ListCard from "../cards/list-card";
|
import ListCard from "../cards/list-card";
|
||||||
import MagazineCard from "../cards/magazine-card";
|
import MagazineCard from "../cards/magazine-card";
|
||||||
import CompactCard from "../cards/compact-card";
|
import CompactCard from "../cards/compact-card";
|
||||||
|
import { Card } from "../cards/card";
|
||||||
|
|
||||||
class ListFeed extends React.Component<FeedProps> {
|
class ListFeed extends React.Component<FeedProps> {
|
||||||
onRenderItem = (item: RSSItem) => {
|
onRenderItem = (item: RSSItem) => {
|
||||||
@ -22,6 +23,9 @@ class ListFeed extends React.Component<FeedProps> {
|
|||||||
markRead: this.props.markRead,
|
markRead: this.props.markRead,
|
||||||
contextMenu: this.props.contextMenu,
|
contextMenu: this.props.contextMenu,
|
||||||
showItem: this.props.showItem,
|
showItem: this.props.showItem,
|
||||||
|
} as Card.Props
|
||||||
|
if (this.props.viewType === ViewType.List && this.props.currentItem === item._id) {
|
||||||
|
props.selected = true
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.props.viewType) {
|
switch (this.props.viewType) {
|
||||||
|
@ -19,17 +19,19 @@ const getFeed = (state: RootState, props: FeedContainerProps) => state.feeds[pro
|
|||||||
const getFilter = (state: RootState) => state.page.filter
|
const getFilter = (state: RootState) => state.page.filter
|
||||||
const getView = (_, props: FeedContainerProps) => props.viewType
|
const getView = (_, props: FeedContainerProps) => props.viewType
|
||||||
const getViewConfigs = (state: RootState) => state.page.viewConfigs
|
const getViewConfigs = (state: RootState) => state.page.viewConfigs
|
||||||
|
const getCurrentItem = (state: RootState) => state.page.itemId
|
||||||
|
|
||||||
const makeMapStateToProps = () => {
|
const makeMapStateToProps = () => {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
[getSources, getItems, getFeed, getView, getFilter, getViewConfigs],
|
[getSources, getItems, getFeed, getView, getFilter, getViewConfigs, getCurrentItem],
|
||||||
(sources, items, feed, viewType, filter, viewConfigs) => ({
|
(sources, items, feed, viewType, filter, viewConfigs, currentItem) => ({
|
||||||
feed: feed,
|
feed: feed,
|
||||||
items: feed.iids.map(iid => items[iid]),
|
items: feed.iids.map(iid => items[iid]),
|
||||||
sourceMap: sources,
|
sourceMap: sources,
|
||||||
filter: filter,
|
filter: filter,
|
||||||
viewType: viewType,
|
viewType: viewType,
|
||||||
viewConfigs: viewConfigs,
|
viewConfigs: viewConfigs,
|
||||||
|
currentItem: currentItem,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user