@team-monolith/cds 1.74.5 → 1.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -9
- package/dist/components/Banner.d.ts +8 -2
- package/dist/components/Banner.js +17 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,15 +26,6 @@
|
|
|
26
26
|
- React JSX 형태로 export되는 값은 다음 예시와 같이 pascal case로 네이밍됩니다. (예: `ArrowDownCircleFillIcon`)
|
|
27
27
|
- svg 파일 이름이 숫자로 시작하는 경우, 제일 앞에 `i`를 붙입니다. (예: `4k-fill.svg` -> `i4KFillSvg`, `I4KFillIcon`)
|
|
28
28
|
|
|
29
|
-
## 브랜치 관리
|
|
30
|
-
|
|
31
|
-
현재 CDS에서는 React 18 기준으로 개발하고 있습니다.
|
|
32
|
-
|
|
33
|
-
- **main** : React 18
|
|
34
|
-
|
|
35
|
-
과거 코들 스튜디오 시스템에서의 JL4 과업이 완료되지 않아, 두가지 버전을 동시에 관리했었습니다.
|
|
36
|
-
과거 버전(`v0.x`)은 React 17 기반 [jce-codle-jlext](https://github.com/team-monolith-product/jce-codle-jlext)의 JL3에서 사용했고, 1.0 브랜치(`v1.x`)는 현재 JL4와 [jce-codle-react](https://github.com/team-monolith-product/jce-codle-react)에서 사용중입니다.
|
|
37
|
-
|
|
38
29
|
## 개발 및 배포 절차
|
|
39
30
|
|
|
40
31
|
`npm run storybook` 을 실행하면 스토리북이 실행됩니다. 이곳에서 디버깅을 진행합니다.
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ButtonProps } from "./Button";
|
|
3
3
|
export type BannerColor = "red" | "blue" | "green" | "yellow" | "white";
|
|
4
|
+
export declare const bannerClasses: {
|
|
5
|
+
readonly icon: "Banner-icon";
|
|
6
|
+
readonly textContainer: "Banner-textContainer";
|
|
7
|
+
readonly headline: "Banner-textContainer-headline";
|
|
8
|
+
readonly content: "Banner-textContainer-content";
|
|
9
|
+
readonly button: "Banner-button";
|
|
10
|
+
readonly closeSquareButton: "Banner-closeSquareButton";
|
|
11
|
+
};
|
|
4
12
|
export interface BannerProps {
|
|
5
13
|
className?: string;
|
|
6
14
|
component?: React.ElementType;
|
|
@@ -16,8 +24,6 @@ export interface BannerProps {
|
|
|
16
24
|
buttonLabel?: string;
|
|
17
25
|
/** 컴포넌트 우측 버튼 클릭 시 호출될 콜백 함수 */
|
|
18
26
|
onButtonClick?: () => void;
|
|
19
|
-
/** 버튼 컴포넌트에 삽입될 ClassName */
|
|
20
|
-
buttonClassName?: string;
|
|
21
27
|
/** Button에 전달될 Props */
|
|
22
28
|
buttonProps?: Omit<ButtonProps, "className" | "label" | "onClick">;
|
|
23
29
|
/** 컴포넌트 우측에 표기될 닫기 버튼 유무 */
|
|
@@ -17,6 +17,14 @@ import React from "react";
|
|
|
17
17
|
import { CloseFillIcon } from "../icons";
|
|
18
18
|
import SquareButton from "./SquareButton";
|
|
19
19
|
import Button from "./Button";
|
|
20
|
+
export const bannerClasses = {
|
|
21
|
+
icon: "Banner-icon",
|
|
22
|
+
textContainer: "Banner-textContainer",
|
|
23
|
+
headline: "Banner-textContainer-headline",
|
|
24
|
+
content: "Banner-textContainer-content",
|
|
25
|
+
button: "Banner-button",
|
|
26
|
+
closeSquareButton: "Banner-closeSquareButton",
|
|
27
|
+
};
|
|
20
28
|
const COLOR_PALETTE = (theme, color) => ({
|
|
21
29
|
red: {
|
|
22
30
|
background: theme.color.container.redContainer,
|
|
@@ -49,7 +57,7 @@ const COLOR_PALETTE = (theme, color) => ({
|
|
|
49
57
|
*/
|
|
50
58
|
// eslint-disable-next-line react/display-name, @typescript-eslint/no-explicit-any
|
|
51
59
|
const Banner = React.forwardRef((props, ref) => {
|
|
52
|
-
const { className, component: Component = "div", headline, content, icon, color, buttonLabel,
|
|
60
|
+
const { className, component: Component = "div", headline, content, icon, color, buttonLabel, onButtonClick, buttonProps, close, onClose, fullWidth } = props, other = __rest(props, ["className", "component", "headline", "content", "icon", "color", "buttonLabel", "onButtonClick", "buttonProps", "close", "onClose", "fullWidth"]);
|
|
53
61
|
const theme = useTheme();
|
|
54
62
|
return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: className, css: [
|
|
55
63
|
css `
|
|
@@ -67,17 +75,17 @@ const Banner = React.forwardRef((props, ref) => {
|
|
|
67
75
|
border-radius: 12px;
|
|
68
76
|
width: fit-content;
|
|
69
77
|
`,
|
|
70
|
-
] }, { children: [icon && (_jsx(
|
|
78
|
+
] }, { children: [icon && (_jsx(Icon, Object.assign({ className: bannerClasses.icon, css: css `
|
|
71
79
|
align-self: ${headline && content ? "flex-start" : "center"};
|
|
72
80
|
color: ${COLOR_PALETTE(theme, color).headline};
|
|
73
|
-
` }, { children: icon }))), _jsxs(TextContainer, { children: [headline && (_jsx(
|
|
81
|
+
` }, { children: icon }))), _jsxs(TextContainer, Object.assign({ className: bannerClasses.textContainer }, { children: [headline && (_jsx(Headline, Object.assign({ className: bannerClasses.headline, css: css `
|
|
74
82
|
color: ${COLOR_PALETTE(theme, color).headline};
|
|
75
|
-
` }, { children: headline }))), content && (_jsx(
|
|
83
|
+
` }, { children: headline }))), content && (_jsx(Content, Object.assign({ className: bannerClasses.content, css: css `
|
|
76
84
|
color: ${COLOR_PALETTE(theme, color).content};
|
|
77
|
-
` }, { children: content })))] }), buttonLabel && (_jsx(Button, Object.assign({ className:
|
|
85
|
+
` }, { children: content })))] })), buttonLabel && (_jsx(Button, Object.assign({ className: bannerClasses.button, css: !buttonProps &&
|
|
78
86
|
css `
|
|
79
87
|
color: ${COLOR_PALETTE(theme, color).content};
|
|
80
|
-
`, color: "textNeutral", size: "small", label: buttonLabel, onClick: onButtonClick }, buttonProps))), close && (_jsx(SquareButton, { css: css `
|
|
88
|
+
`, color: "textNeutral", size: "small", label: buttonLabel, onClick: onButtonClick }, buttonProps))), close && (_jsx(SquareButton, { className: bannerClasses.closeSquareButton, css: css `
|
|
81
89
|
> button {
|
|
82
90
|
color: ${COLOR_PALETTE(theme, color).content};
|
|
83
91
|
}
|
|
@@ -85,7 +93,7 @@ const Banner = React.forwardRef((props, ref) => {
|
|
|
85
93
|
"aria-label": "닫기",
|
|
86
94
|
} }))] })));
|
|
87
95
|
});
|
|
88
|
-
const
|
|
96
|
+
const Icon = styled.div `
|
|
89
97
|
display: flex;
|
|
90
98
|
align-items: flex-start;
|
|
91
99
|
padding: 12px 0px;
|
|
@@ -95,14 +103,14 @@ const IconDiv = styled.div `
|
|
|
95
103
|
height: 20px;
|
|
96
104
|
}
|
|
97
105
|
`;
|
|
98
|
-
const
|
|
106
|
+
const Headline = styled.div(({ theme }) => css `
|
|
99
107
|
font-family: ${theme.fontFamily.ui};
|
|
100
108
|
font-size: 16px;
|
|
101
109
|
font-style: normal;
|
|
102
110
|
font-weight: 700;
|
|
103
111
|
line-height: 20px; /* 125% */
|
|
104
112
|
`);
|
|
105
|
-
const
|
|
113
|
+
const Content = styled.div(({ theme }) => css `
|
|
106
114
|
font-family: ${theme.fontFamily.ui};
|
|
107
115
|
font-size: 16px;
|
|
108
116
|
font-style: normal;
|