From 3964c086e6ebe73bbaa99c82528a420173f5e464 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Mon, 16 May 2022 12:25:48 +0300 Subject: [PATCH] style: blog components responsive --- .../Comments/AddComment/AddComment.tsx | 2 +- .../Components/Comments/Comment/Comment.tsx | 4 +-- .../BountyApplicants.stories.tsx | 29 +++++++++++++++ .../BountyPageContent/BountyApplicants.tsx | 36 +++++++++++++++++++ .../BountyPageContent.stories.tsx | 24 +++++++++++++ .../BountyPageContent.tsx | 23 +++--------- .../Components/PageContent/PageContent.tsx | 6 ++-- .../QuestionPageContent.stories.tsx | 24 +++++++++++++ .../QuestionPageContent.tsx | 2 +- .../StoryPageContent.stories.tsx | 24 +++++++++++++ .../StoryPageContent.tsx | 2 +- 11 files changed, 150 insertions(+), 26 deletions(-) create mode 100644 src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyApplicants.stories.tsx create mode 100644 src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyApplicants.tsx create mode 100644 src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.stories.tsx rename src/features/Posts/pages/PostDetailsPage/Components/{PageContent => BountyPageContent}/BountyPageContent.tsx (71%) create mode 100644 src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.stories.tsx rename src/features/Posts/pages/PostDetailsPage/Components/{PageContent => QuestionPageContent}/QuestionPageContent.tsx (97%) create mode 100644 src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.stories.tsx rename src/features/Posts/pages/PostDetailsPage/Components/{PageContent => StoryPageContent}/StoryPageContent.tsx (97%) diff --git a/src/features/Posts/Components/Comments/AddComment/AddComment.tsx b/src/features/Posts/Components/Comments/AddComment/AddComment.tsx index 2edeaba..24f5089 100644 --- a/src/features/Posts/Components/Comments/AddComment/AddComment.tsx +++ b/src/features/Posts/Components/Comments/AddComment/AddComment.tsx @@ -103,7 +103,7 @@ export default function AddComment({ initialContent, placeholder, name, autoFocu autoFocus={autoFocus} >
-
+
diff --git a/src/features/Posts/Components/Comments/Comment/Comment.tsx b/src/features/Posts/Components/Comments/Comment/Comment.tsx index 7d19d40..a5cd688 100644 --- a/src/features/Posts/Components/Comments/Comment/Comment.tsx +++ b/src/features/Posts/Components/Comments/Comment/Comment.tsx @@ -26,8 +26,8 @@ export default function Comment({ comment, onClickedReply }: Props) { return (
- {(comment.replies.length > 0 || replyOpen) &&
-
+ {(comment.replies.length > 0 || replyOpen) &&
+
{comment.replies.map(reply => ; + + +const Template: ComponentStory = (args) =>
+ +export const Default = Template.bind({}); +Default.args = { + applications: MOCK_DATA.posts.bounties[0]['applications'] +} + + +export const Empty = Template.bind({}); +Empty.args = { + applications: [] +} + + + diff --git a/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyApplicants.tsx b/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyApplicants.tsx new file mode 100644 index 0000000..a75979b --- /dev/null +++ b/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyApplicants.tsx @@ -0,0 +1,36 @@ +import { FiMeh } from 'react-icons/fi' +import Header from 'src/features/Posts/Components/PostCard/Header/Header' +import { Bounty } from 'src/features/Posts/types' + +interface Props { + applications: Bounty['applications'] +} + +export default function BountyApplicants({ applications }: Props) { + return ( +
+

Applicants

+ {applications.length > 0 &&
    + {applications.map(application => +
  • +
    +
    +

    Work Plan

    +

    {application.workplan}

    +
    +
  • + )} + +
} + {applications.length === 0 &&
+ +

+ No applicants yet +

+

+ The current bounty has no current appliacants +

+
} +
+ ) +} diff --git a/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.stories.tsx b/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.stories.tsx new file mode 100644 index 0000000..e06ff84 --- /dev/null +++ b/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.stories.tsx @@ -0,0 +1,24 @@ +import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { MOCK_DATA } from 'src/mocks/data'; + +import BountyPageContent from './BountyPageContent'; + +export default { + title: 'Posts/Post Details Page/Components/Bounty Page Content', + component: BountyPageContent, + argTypes: { + backgroundColor: { control: 'color' }, + }, +} as ComponentMeta; + + +const Template: ComponentStory = (args) =>
+ +export const Default = Template.bind({}); +Default.args = { + bounty: MOCK_DATA.posts.bounties[0] +} + + + + diff --git a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/BountyPageContent.tsx b/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.tsx similarity index 71% rename from src/features/Posts/pages/PostDetailsPage/Components/PageContent/BountyPageContent.tsx rename to src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.tsx index 0073c01..ef50742 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/BountyPageContent.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/BountyPageContent/BountyPageContent.tsx @@ -1,12 +1,13 @@ import Header from "src/features/Posts/Components/PostCard/Header/Header" import { Bounty, } from "src/features/Posts/types" import { marked } from 'marked'; -import styles from './styles.module.css' +import styles from '../PageContent/styles.module.css' import Badge from "src/Components/Badge/Badge"; import { BiComment } from "react-icons/bi"; import VotesCount from "src/Components/VotesCount/VotesCount"; import Button from "src/Components/Button/Button"; import { FiGithub, FiShare2 } from "react-icons/fi"; +import BountyApplicants from "./BountyApplicants"; interface Props { @@ -20,7 +21,7 @@ export default function BountyPageContent({ bounty }: Props) { {/* Header */}
-

{bounty.title} Bounty

+

{bounty.title} Bounty

Reward: {bounty.reward_amount} sats @@ -31,7 +32,7 @@ export default function BountyPageContent({ bounty }: Props) { 32 Comments
-
+
@@ -52,21 +53,7 @@ export default function BountyPageContent({ bounty }: Props) { )}
{/* Applicants */} -
-

Applicants

-
    - {bounty.applications.map(application => -
  • -
    -
    -

    Work Plan

    -

    {application.workplan}

    -
    -
  • - )} - -
-
+
) } diff --git a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/PageContent.tsx b/src/features/Posts/pages/PostDetailsPage/Components/PageContent/PageContent.tsx index 71e4717..0945666 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/PageContent.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/PageContent/PageContent.tsx @@ -1,8 +1,8 @@ import { isBounty, isQuestion, isStory, Post } from "src/features/Posts/types" -import StoryPageContent from "./StoryPageContent"; -import BountyPageContent from "./BountyPageContent"; +import StoryPageContent from "../StoryPageContent/StoryPageContent"; +import BountyPageContent from "../BountyPageContent/BountyPageContent"; +import QuestionPageContent from "../QuestionPageContent/QuestionPageContent"; import { PostDetailsQuery } from "src/graphql"; -import QuestionPageContent from "./QuestionPageContent"; interface Props { diff --git a/src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.stories.tsx b/src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.stories.tsx new file mode 100644 index 0000000..700f41b --- /dev/null +++ b/src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.stories.tsx @@ -0,0 +1,24 @@ +import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { MOCK_DATA } from 'src/mocks/data'; + +import QuestionPageContent from './QuestionPageContent'; + +export default { + title: 'Posts/Post Details Page/Components/Question Page Content', + component: QuestionPageContent, + argTypes: { + backgroundColor: { control: 'color' }, + }, +} as ComponentMeta; + + +const Template: ComponentStory = (args) =>
+ +export const Default = Template.bind({}); +Default.args = { + question: MOCK_DATA.posts.questions[0] +} + + + + diff --git a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/QuestionPageContent.tsx b/src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.tsx similarity index 97% rename from src/features/Posts/pages/PostDetailsPage/Components/PageContent/QuestionPageContent.tsx rename to src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.tsx index 95e7986..d88d220 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/QuestionPageContent.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/QuestionPageContent/QuestionPageContent.tsx @@ -1,7 +1,7 @@ import Header from "src/features/Posts/Components/PostCard/Header/Header" import { Question } from "src/features/Posts/types" import { marked } from 'marked'; -import styles from './styles.module.css' +import styles from '../PageContent/styles.module.css' import Badge from "src/Components/Badge/Badge"; import { BiComment } from "react-icons/bi"; import { RiFlashlightLine } from "react-icons/ri"; diff --git a/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.stories.tsx b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.stories.tsx new file mode 100644 index 0000000..d12f647 --- /dev/null +++ b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.stories.tsx @@ -0,0 +1,24 @@ +import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { MOCK_DATA } from 'src/mocks/data'; + +import StoryPageContent from './StoryPageContent'; + +export default { + title: 'Posts/Post Details Page/Components/Story Page Content', + component: StoryPageContent, + argTypes: { + backgroundColor: { control: 'color' }, + }, +} as ComponentMeta; + + +const Template: ComponentStory = (args) =>
+ +export const Default = Template.bind({}); +Default.args = { + story: MOCK_DATA.posts.stories[0] +} + + + + diff --git a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/StoryPageContent.tsx b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.tsx similarity index 97% rename from src/features/Posts/pages/PostDetailsPage/Components/PageContent/StoryPageContent.tsx rename to src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.tsx index d9686f6..92e47ac 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/PageContent/StoryPageContent.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/StoryPageContent.tsx @@ -1,7 +1,7 @@ import Header from "src/features/Posts/Components/PostCard/Header/Header" import { Story } from "src/features/Posts/types" import { marked } from 'marked'; -import styles from './styles.module.css' +import styles from '../PageContent/styles.module.css' import Badge from "src/Components/Badge/Badge"; import { BiComment } from "react-icons/bi"; import { RiFlashlightLine } from "react-icons/ri";