Skip to content

Commit

Permalink
Show feedback over Article
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachabin committed Aug 27, 2024
1 parent 19cf32a commit 3f27cb6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions client/components/Articles/Article/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ function getContent(html) {
return t(md({ html: true }).render(html));
}

export function Article({ title, description, sidebar, external }: ArticleProps) {
export function Article({ title, description, sidebar, external, onFeedbackClick }: ArticleProps) {
return (
<div className={cn(styles.Article, { [styles.Article_external]: external })}>
{!external && <div className={cn(styles.ArticleControls)}>
<Link className={cn(styles.ArticleBack)} href="/">
<span className={cn(styles.ArticleBackArrow)}></span>
<span className={cn(styles.ArticleBackCaption)}>На главную транспорта</span>
</Link>
<Feedback size="l" />
<Feedback onClick={onFeedbackClick} size="l" />
</div>}
<article className={cn(styles.ArticleContent)}>
<div className={cn(styles.ArticleText)}>
Expand All @@ -32,7 +32,7 @@ export function Article({ title, description, sidebar, external }: ArticleProps)
{sidebar !== undefined && <aside className={cn(styles.ArticleAside)}>
{external && (
<div className={cn(styles.ArticleAsideFeedback)}>
<Feedback size="l" />
<Feedback size="l" onClick={onFeedbackClick} />
</div>
)}
{sidebar && <div dangerouslySetInnerHTML={{ __html: getContent(sidebar) }} />}
Expand Down
3 changes: 2 additions & 1 deletion client/components/Articles/Article/Article.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export type ArticleProps = {
title?: string;
description: string;
sidebar?: string;
external?: boolean
external?: boolean;
onFeedbackClick?: () => void;
};
1 change: 1 addition & 0 deletions client/components/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export function MainPage({ cards, cardsDynamicData, marqueeItems, articles }: Ma
title={openedArticle.title}
description={openedArticle.description}
sidebar={openedArticle.sidebar}
onFeedbackClick={handleCloseModal}
external
/>
</Modal>
Expand Down
3 changes: 2 additions & 1 deletion client/components/UI/Feedback/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import styles from './Feedback.module.css';

const cn = classNames.bind(styles);

export function Feedback({ size } : FeedbackProps) {
export function Feedback({ size, onClick } : FeedbackProps) {
return (
<a
href="https://tally.so#tally-open=mRDkVd&tally-width=650&tally-overlay=1&tally-emoji-animation=none"
target="_blank"
rel="noreferrer"
className={cn(styles.Feedback, { [styles[`Feedback_Size-${size}`]]: size })}
onClick={onClick}
>
Фидбек
</a>
Expand Down
1 change: 1 addition & 0 deletions client/components/UI/Feedback/Feedback.types.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type FeedbackProps = {
caption?: string;
size: 'm' | 'l';
onClick?: () => void
};

1 comment on commit 3f27cb6

@ekbdev
Copy link

@ekbdev ekbdev commented on 3f27cb6 Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for transport ready!

✅ Preview
https://transport-fsqwxp9lu-ekbdevs-projects.vercel.app
https://ekbdev-transport-feedback-over-modal.vercel.app

Built with commit 3f27cb6.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.