Skip to content

feat : 후원사 페이지 아코디언 컴포넌트 마크업 진행 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/pyconkr-admin/src/consts/mdx_components.ts
Original file line number Diff line number Diff line change
@@ -136,6 +136,7 @@ const PyConKRCommonMDXComponents: MDXComponents = {
Common__Components__MDX__PrimaryStyledDetails: Common.Components.MDX.PrimaryStyledDetails,
Common__Components__MDX__SecondaryStyledDetails: Common.Components.MDX.SecondaryStyledDetails,
Common__Components__MDX__Map: Common.Components.MDX.Map,
Common__Components__MDX__FAQAccordion: Common.Components.MDX.FAQAccordion,
};

const PythonKRShopMDXComponents: MDXComponents = {
1 change: 1 addition & 0 deletions apps/pyconkr/src/consts/mdx_components.ts
Original file line number Diff line number Diff line change
@@ -136,6 +136,7 @@ const PyConKRCommonMDXComponents: MDXComponents = {
Common__Components__MDX__PrimaryStyledDetails: Common.Components.MDX.PrimaryStyledDetails,
Common__Components__MDX__SecondaryStyledDetails: Common.Components.MDX.SecondaryStyledDetails,
Common__Components__MDX__Map: Common.Components.MDX.Map,
Common__Components__MDX__FAQAccordion: Common.Components.MDX.FAQAccordion,
};

const PythonKRShopMDXComponents: MDXComponents = {
8 changes: 8 additions & 0 deletions packages/common/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,11 @@ import {
NetworkLottiePlayer as NetworkLottiePlayerComponent,
} from "./lottie";
import { MDXRenderer as MDXRendererComponent } from "./mdx";
import {
FAQAccordion as FAQAccordionComponent,
type FAQAccordionProps as FAQAccordionPropsType,
type FAQItem as FAQItemType,
} from "./mdx_components/faq_accordion";
import type { MapPropType as MapComponentPropType } from "./mdx_components/map";
import { Map as MapComponent } from "./mdx_components/map";
import {
@@ -39,7 +44,10 @@ namespace Components {
export const PrimaryStyledDetails = PrimaryStyledDetailsComponent;
export const SecondaryStyledDetails = SecondaryStyledDetailsComponent;
export const Map = MapComponent;
export const FAQAccordion = FAQAccordionComponent;
export type MapPropType = MapComponentPropType;
export type FAQAccordionProps = FAQAccordionPropsType;
export type FAQItem = FAQItemType;
}
}

107 changes: 107 additions & 0 deletions packages/common/src/components/mdx_components/faq_accordion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import { Accordion as MuiAccordion, AccordionDetails, AccordionSummary } from "@mui/material";
import styled from "@emotion/styled";
import * as React from "react";

export interface FAQItem {
id: string;
question: string;
answer: string;
}

export interface FAQAccordionProps {
items: FAQItem[];
}

export const FAQAccordion: React.FC<FAQAccordionProps> = ({ items }) => {
return (
<AccordionWrapper>
{items.map((faq, index) => (
<React.Fragment key={faq.id}>
<StyledAccordion>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls={`panel${faq.id}-content`}
id={`panel${faq.id}-header`}
>
<Number>{faq.id}</Number>
<Question>{faq.question}</Question>
</AccordionSummary>
<StyledAccordionDetails>{faq.answer}</StyledAccordionDetails>
</StyledAccordion>
{index !== items.length - 1 && <Divider />}
</React.Fragment>
))}
</AccordionWrapper>
);
};

const AccordionWrapper = styled.div`
display: flex;
flex-direction: column;
border-top: 1px solid ${({ theme }) => theme.palette.primary.dark};
border-bottom: 1px solid ${({ theme }) => theme.palette.primary.dark};
`;

const Divider = styled.div`
height: 1px;
background-color: ${({ theme }) => theme.palette.primary.light};
margin: 0;
`;

const StyledAccordion = styled(MuiAccordion)`
box-shadow: none;
border-radius: 0;
&:before {
display: none;
}
&.MuiAccordion-root {
margin: 0;
&:first-of-type {
border-top: none;
}
&:last-of-type {
border-bottom: none;
}
}
.MuiAccordionSummary-root {
padding: 10px 35px;
min-height: 60px;
max-height: 60px;
.MuiAccordionSummary-content {
display: flex;
align-items: center;
margin: 0;
}
&.Mui-expanded {
min-height: 60px;
max-height: 60px;
}
}
`;

const Number = styled.span`
font-size: 18px;
font-weight: 400;
`;

const Question = styled.span`
font-size: 18px;
font-weight: 400;
margin-left: 60px;
`;

const StyledAccordionDetails = styled(AccordionDetails)`
background-color: ${({ theme }) => `${theme.palette.primary.light}26`}; // 15% opacity (26 in hex)
color: ${({ theme }) => theme.palette.primary.dark};
font-size: 14px;
font-weight: 400;
padding: 20px 0 20px calc(35px + 18px + 60px); // top right bottom left
`;