Skip to content

Commit 58fbc07

Browse files
authored
Merge pull request #40 from SOPT-all/feat/floating-button/#39
[feat/#39] floating button 컴포넌트 구현
2 parents a4cdb9e + 05bd431 commit 58fbc07

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { typographyVars } from "@/shared/styles/typography.css";
2+
import { color } from "@/shared/styles/tokens/color.css";
3+
import { style } from "@vanilla-extract/css";
4+
5+
export const container = style({
6+
padding: "0.8rem 1.2rem 0.8rem 0.8rem",
7+
display: "inline-flex",
8+
gap: "0.4rem",
9+
alignItems: "center",
10+
borderRadius: "20px",
11+
backgroundColor: "transparent",
12+
cursor: "pointer",
13+
userSelect: "none", // 버튼 드래그 방지, 더블클릭 시 텍스트 파란색으로 하이라이트 방지
14+
whiteSpace: "nowrap",
15+
transition: "background-color 0.2s ease, transform 0.2s ease",
16+
boxShadow: "0px 4px 4px 0px rgba(18, 18, 18, 0.04)",
17+
18+
":active": {
19+
backgroundColor: color.white[300],
20+
transform: "scale(0.97)",
21+
},
22+
});
23+
24+
export const content = style({
25+
...typographyVars.body3,
26+
color: color.black[200],
27+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
import * as styles from "./floating-button.css";
3+
import { ChatFloating } from "@/assets/svg";
4+
5+
interface Props extends React.ComponentProps<"button"> {
6+
content?: string;
7+
}
8+
9+
const FloatingButton = ({ content = "작품 문의", ...props }: Props) => {
10+
return (
11+
<button className={styles.container} {...props}>
12+
<ChatFloating />
13+
<span className={styles.content}>{content}</span>
14+
</button>
15+
);
16+
};
17+
18+
export default FloatingButton;

0 commit comments

Comments
 (0)