Skip to content

Commit 6a76b16

Browse files
committed
feat: 후원사에 태그 추가
1 parent 3a41f66 commit 6a76b16

File tree

2 files changed

+86
-14
lines changed

2 files changed

+86
-14
lines changed

apps/pyconkr/src/components/layout/Sponsor/index.tsx

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as Common from "@frontend/common";
2-
import { CircularProgress, Divider, Stack, Tooltip, Typography, TypographyProps, styled } from "@mui/material";
2+
import { Badge, CircularProgress, Divider, Stack, Tooltip, Typography, TypographyProps, styled } from "@mui/material";
33
import { ErrorBoundary, Suspense } from "@suspensive/react";
44
import { Link } from "react-router-dom";
55

66
import { useAppContext } from "../../../contexts/app_context";
77

88
const LogoHeight: React.CSSProperties["height"] = "8rem";
99
const LogoWidth: React.CSSProperties["width"] = "15rem";
10+
const LogoContainerHeight: React.CSSProperties["height"] = `calc(${LogoHeight} + 2rem)`;
11+
const LogoContainerWidth: React.CSSProperties["width"] = `calc(${LogoWidth} + 4rem)`;
1012

1113
const SponsorContainer = styled(Stack)({
1214
width: "100%",
@@ -26,27 +28,89 @@ const SponsorStack = styled(Stack)({
2628
justifyContent: "center",
2729
alignItems: "center",
2830
padding: "0 1rem",
29-
gap: "2rem",
31+
gap: "4rem",
3032
});
3133

32-
const LogoImageContainer = styled(Stack)({
34+
const LogoImageEqualWidthContainer = styled(Stack)(({ theme }) => ({
35+
position: "relative",
3336
alignItems: "center",
3437
justifyContent: "center",
3538
alignContent: "stretch",
36-
height: LogoHeight,
37-
maxHeight: LogoHeight,
39+
height: LogoContainerHeight,
40+
maxHeight: LogoContainerHeight,
41+
minWidth: LogoContainerWidth,
42+
maxWidth: LogoContainerWidth,
43+
border: `1px solid ${theme.palette.primary.light}`,
44+
borderRadius: "0.5rem",
45+
46+
transition: "all 0.3s ease-in-out",
47+
48+
"&:hover": {
49+
borderColor: theme.palette.primary.dark,
50+
boxShadow: theme.shadows[3],
51+
},
52+
}));
53+
54+
const LogoImageContainer = styled(Stack)({
55+
width: "auto",
56+
height: "auto",
57+
minHeight: LogoHeight,
3858
maxWidth: LogoWidth,
59+
maxHeight: LogoHeight,
60+
objectFit: "contain",
61+
alignItems: "center",
62+
justifyContent: "center",
63+
margin: "4rem 8rem",
3964
});
4065

4166
const LogoImage = styled("img")({
42-
height: `calc(${LogoHeight} * 0.9)`, // 90% of LogoHeight
67+
width: "auto",
68+
height: "auto",
4369
minHeight: LogoHeight,
44-
minWidth: `calc(${LogoWidth} * 0.9)`, // 80% of LogoWidth
45-
maxWidth: "100%",
46-
maxHeight: "100%",
70+
maxWidth: LogoWidth,
71+
maxHeight: LogoHeight,
4772
objectFit: "contain",
4873
});
4974

75+
const LogoBadgeContainer = styled(Stack)({
76+
position: "absolute",
77+
width: "auto",
78+
height: "auto",
79+
top: "0.5rem",
80+
right: "-0.5rem",
81+
flexDirection: "column",
82+
alignItems: "flex-end",
83+
justifyContent: "center",
84+
gap: "0.25rem",
85+
});
86+
87+
const LogoBadge = styled(Badge)(({ theme }) => ({
88+
alignItems: "flex-end",
89+
90+
"& .MuiBadge-badge": {
91+
position: "relative",
92+
borderRadius: "0.25rem",
93+
// height: "1rem",
94+
padding: "0 0.5rem",
95+
backgroundColor: theme.palette.primary.main,
96+
// color: theme.palette.primary.main,
97+
// border: `1px solid ${theme.palette.primary.main}`,
98+
borderEndEndRadius: "0",
99+
transform: "none",
100+
101+
"&:after": {
102+
content: '""',
103+
position: "absolute",
104+
bottom: "-8px",
105+
right: "-0.1px",
106+
width: 0,
107+
height: 0,
108+
border: "solid 4px",
109+
borderColor: `${theme.palette.primary.dark} transparent transparent ${theme.palette.primary.dark}`,
110+
},
111+
},
112+
}));
113+
50114
export const Sponsor: React.FC = ErrorBoundary.with(
51115
{
52116
fallback: (
@@ -87,11 +151,18 @@ export const Sponsor: React.FC = ErrorBoundary.with(
87151
const sponsorName = sponsor.name.replace(/\\n/g, "\n");
88152
const sponsorNameContent = <Typography variant="body1" {...textProps} children={sponsorName} sx={{ whiteSpace: "pre-wrap" }} />;
89153
const sponsorImg = (
90-
<LogoImageContainer>
91-
<Tooltip title={sponsorNameContent} arrow placement="top">
92-
<LogoImage src={sponsor.logo} alt={sponsor.name} loading="lazy" />
93-
</Tooltip>
94-
</LogoImageContainer>
154+
<Tooltip title={sponsorNameContent} arrow placement="top">
155+
<LogoImageEqualWidthContainer>
156+
<LogoBadgeContainer>
157+
{sponsor.tags.map((tag, i) => (
158+
<LogoBadge key={i} badgeContent={tag} />
159+
))}
160+
</LogoBadgeContainer>
161+
<LogoImageContainer>
162+
<LogoImage src={sponsor.logo} alt={sponsor.name} loading="lazy" />
163+
</LogoImageContainer>
164+
</LogoImageEqualWidthContainer>
165+
</Tooltip>
95166
);
96167
return sponsor.sitemap_id ? <Link to={flatSiteMapObj[sponsor.sitemap_id].route} children={sponsorImg} /> : sponsorImg;
97168
})}

packages/common/src/schemas/backendAPI.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ namespace BackendAPISchemas {
6464
name: string;
6565
logo: string;
6666
sitemap_id: string | null;
67+
tags: string[];
6768
}[];
6869
};
6970

0 commit comments

Comments
 (0)