Feed article actions popup
This commit is contained in:
parent
eac6ad7d4c
commit
0d0494a83a
|
@ -411,20 +411,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.shoutCardDetails {
|
.shoutCardDetails {
|
||||||
border-top: 3px solid #141414;
|
align-items: flex-start;
|
||||||
|
border-top: 2px solid #141414;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@include font-size(1.5rem);
|
@include font-size(1.5rem);
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
padding: 1em 0 1.5em;
|
padding: 1em 0 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 2;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shoutCardDetailsContent {
|
.shoutCardDetailsContent {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
padding: 0 1em 1em 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.shoutCardDetailsItem {
|
.shoutCardDetailsItem {
|
||||||
|
@ -465,6 +470,10 @@
|
||||||
&:hover {
|
&:hover {
|
||||||
background: none;
|
background: none;
|
||||||
color: rgb(0 0 0 / 60%);
|
color: rgb(0 0 0 / 60%);
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { RatingControl } from '../Article/RatingControl'
|
||||||
import { getShareUrl, SharePopup } from '../Article/SharePopup'
|
import { getShareUrl, SharePopup } from '../Article/SharePopup'
|
||||||
import stylesHeader from '../Nav/Header.module.scss'
|
import stylesHeader from '../Nav/Header.module.scss'
|
||||||
import { getDescription } from '../../utils/meta'
|
import { getDescription } from '../../utils/meta'
|
||||||
|
import { FeedArticlePopup } from './FeedArticlePopup'
|
||||||
|
|
||||||
interface ArticleCardProps {
|
interface ArticleCardProps {
|
||||||
settings?: {
|
settings?: {
|
||||||
|
@ -207,9 +208,18 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class={styles.shoutCardDetailsItem}>
|
<div class={styles.shoutCardDetailsItem}>
|
||||||
<button>
|
<FeedArticlePopup
|
||||||
<Icon name="ellipsis" class={clsx(styles.icon, styles.feedControlIcon)} />
|
containerCssClass={stylesHeader.control}
|
||||||
</button>
|
title={props.article['title']}
|
||||||
|
description={getDescription(props.article['body'])}
|
||||||
|
imageUrl={props.article['cover']}
|
||||||
|
shareUrl={getShareUrl({ pathname: `/${slug}` })}
|
||||||
|
trigger={
|
||||||
|
<button>
|
||||||
|
<Icon name="ellipsis" class={clsx(styles.icon, styles.feedControlIcon)} />
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
21
src/components/Feed/FeedArticlePopup.module.scss
Normal file
21
src/components/Feed/FeedArticlePopup.module.scss
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
.feedArticlePopup {
|
||||||
|
box-shadow: none !important;
|
||||||
|
border: 1px solid rgb(0 0 0 / 0.15);
|
||||||
|
border-radius: 1.6rem;
|
||||||
|
padding: 1.6rem !important;
|
||||||
|
|
||||||
|
@include media-breakpoint-between(sm, md) {
|
||||||
|
left: auto !important;
|
||||||
|
right: 0;
|
||||||
|
transform: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
color: #696969;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #000;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
src/components/Feed/FeedArticlePopup.tsx
Normal file
60
src/components/Feed/FeedArticlePopup.tsx
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import styles from './FeedArticlePopup.module.scss'
|
||||||
|
import type { PopupProps } from '../_shared/Popup'
|
||||||
|
import { Popup } from '../_shared/Popup'
|
||||||
|
|
||||||
|
type FeedArticlePopupProps = {
|
||||||
|
title: string
|
||||||
|
shareUrl?: string
|
||||||
|
imageUrl: string
|
||||||
|
description: string
|
||||||
|
} & Omit<PopupProps, 'children'>
|
||||||
|
|
||||||
|
export const getShareUrl = (params: { pathname?: string } = {}) => {
|
||||||
|
if (typeof location === 'undefined') return ''
|
||||||
|
const pathname = params.pathname ?? location.pathname
|
||||||
|
return location.origin + pathname
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FeedArticlePopup = (props: FeedArticlePopupProps) => {
|
||||||
|
return (
|
||||||
|
<Popup {...props} variant="tiny" popupCssClass={styles.feedArticlePopup}>
|
||||||
|
<ul class="nodash">
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Поделиться
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Помочь редактировать
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Пригласить экспертов
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Подписаться на комментарии
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Добавить в закладки
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Пожаловаться
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button role="button" onClick={() => {}}>
|
||||||
|
Получать уведомления
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</Popup>
|
||||||
|
)
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ type HorizontalAnchor = 'center' | 'right'
|
||||||
|
|
||||||
export type PopupProps = {
|
export type PopupProps = {
|
||||||
containerCssClass?: string
|
containerCssClass?: string
|
||||||
|
popupCssClass?: string
|
||||||
trigger: JSX.Element
|
trigger: JSX.Element
|
||||||
children: JSX.Element
|
children: JSX.Element
|
||||||
onVisibilityChange?: (isVisible) => void
|
onVisibilityChange?: (isVisible) => void
|
||||||
|
@ -40,7 +41,7 @@ export const Popup = (props: PopupProps) => {
|
||||||
<span onClick={toggle}>{props.trigger}</span>
|
<span onClick={toggle}>{props.trigger}</span>
|
||||||
<Show when={isVisible()}>
|
<Show when={isVisible()}>
|
||||||
<div
|
<div
|
||||||
class={clsx(styles.popup, {
|
class={clsx(styles.popup, props.popupCssClass, {
|
||||||
[styles.horizontalAnchorCenter]: horizontalAnchor === 'center',
|
[styles.horizontalAnchorCenter]: horizontalAnchor === 'center',
|
||||||
[styles.horizontalAnchorRight]: horizontalAnchor === 'right',
|
[styles.horizontalAnchorRight]: horizontalAnchor === 'right',
|
||||||
[styles.bordered]: props.variant === 'bordered',
|
[styles.bordered]: props.variant === 'bordered',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user