Skip to content

Commit ae705b2

Browse files
committed
feat: ai Modal κ΅¬ν˜„
#20
1 parent 3145c51 commit ae705b2

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { css, cx } from "@styled-system/css";
2+
import { glassContainer } from "@styled-system/recipes";
3+
4+
export const popoverContainer = cx(
5+
glassContainer({ border: "md" }),
6+
css({
7+
position: "absolute",
8+
right: "0",
9+
bottom: "100%",
10+
width: "480px",
11+
marginBottom: "24px",
12+
}),
13+
);
14+
15+
export const inputContainer = css({
16+
display: "flex",
17+
justifyContent: "space-between",
18+
borderRadius: "xl",
19+
margin: "10px",
20+
padding: "10px",
21+
backgroundColor: "white/80",
22+
});
23+
24+
export const inputBox = css({
25+
outline: "none",
26+
width: "full",
27+
backgroundColor: "transparent",
28+
});
29+
30+
export const iconBox = css({
31+
display: "flex",
32+
justifyContent: "center",
33+
alignItems: "center",
34+
width: "36px",
35+
cursor: "pointer",
36+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { useState, KeyboardEvent } from "react";
2+
import { motion } from "framer-motion";
3+
import * as style from "./AIModal.style";
4+
import { animation } from "./AiModal.animation";
5+
import { FaLocationArrow } from "react-icons/fa";
6+
7+
const AIModal = ({ onCloseButton }: { onCloseButton: () => void }) => {
8+
const [text, setText] = useState("");
9+
10+
const handleSubmit = () => {};
11+
12+
const handleKeyPress = (e: KeyboardEvent<HTMLInputElement>) => {
13+
if (e.key === "Enter") {
14+
handleSubmit();
15+
}
16+
};
17+
18+
return (
19+
<motion.div
20+
initial={animation.initial}
21+
animate={animation.animate}
22+
transition={animation.transition}
23+
>
24+
<div className={style.popoverContainer}>
25+
<div className={style.inputContainer}>
26+
<input
27+
type="text"
28+
value={text}
29+
onChange={(e) => setText(e.target.value)}
30+
onKeyPress={handleKeyPress}
31+
placeholder="λ¬Έμ„œ μž‘μ„±ν•΄μ€˜"
32+
className={style.inputBox}
33+
/>
34+
<div className={style.iconBox} onClick={handleSubmit}>
35+
<FaLocationArrow />
36+
</div>
37+
</div>
38+
</div>
39+
</motion.div>
40+
);
41+
};
42+
43+
export default AIModal;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export const animation = {
2+
initial: {
3+
y: 100,
4+
opacity: 0,
5+
},
6+
animate: {
7+
y: 0,
8+
opacity: 1,
9+
},
10+
transition: {
11+
type: "spring",
12+
stiffness: 300,
13+
damping: 30,
14+
duration: 0.5,
15+
},
16+
};

0 commit comments

Comments
Β (0)