이 글은 ReactMasterClass강의를 보며 작성한 글입니다.
3월 28일에 작성됨
import styled from "styled-components";
function App() {
return (
<Father>
<Boxone />
<Boxtwo />
</Father>
);
}
const Box = styled.div`
background-color: ${(props) => props.bgColor};
width: 100px;
height: 100px;
`;
function App() {
return (
<Father>
<Box bgColor="teal"></Box>
<Box bgColor="tomato"></Box>
</Father>
);
}
const Box = styled.div`
background-color: ${(props) => props.bgColor};
width: 100px;
height: 100px;
`;
const Circle = styled(Box)`
border-radius: 50%;
`;
function App() {
return (
<Father>
<Box bgColor="teal"></Box>
<Circle bgColor="tomato"></Circle>
</Father>
);
}
function App() {
return (
<Father>
<Btn>Log In</Btn>
<Btn as="a">Log In</Btn>
</Father>
);
}
const Input = styled.input.attrs({ required: true })`
background-color: tomato;
`;
function App() {
return (
<Father>
<Input />
<Input />
<Input />
</Father>
);
}
import styled, { keyframes } from "styled-components";
const rotationAnime = keyframes`
0% {
border-radius: 10px;
}
50% {
border-radius: 100px;
}
100% {
transform: rotate(360deg);
border-radius: 10px;
}
`;
const Box = styled.div`
height: 200px;
width: 200px;
background-color: tomato;
display: flex;
justify-content: center;
align-items: center;
animation: ${rotationAnime} 2s linear infinite forwards;
font-size: 70px;
`;
function App() {
return (
<Wrapper>
<Box>
<span>🤓👆</span>
</Box>
</Wrapper>
);
}
const Box = styled.div`
height: 200px;
width: 200px;
background-color: tomato;
display: flex;
justify-content: center;
align-items: center;
animation: ${rotationAnime} 2s linear infinite forwards;
span {
font-size: 70px;
}
`;
const Box = styled.div`
height: 200px;
width: 200px;
background-color: tomato;
display: flex;
justify-content: center;
align-items: center;
animation: ${rotationAnime} 2s linear infinite forwards;
span {
font-size: 70px;
&:hover {
// span:hover와 동일하다.
}
}
`;
${Emoji} {
&:hover {
// span:hover와 동일하다.
font-size: 70px;
}
}
import { ThemeProvider } from "styled-components";
const darkTheme = {
textColor: "whitesmoke",
backgroundColor: "#111",
};
const lightTheme = {
textColor: "111",
backgroundColor: "whitesmoke",
};
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<ThemeProvider theme={darkTheme}>
<App />
</ThemeProvider>,
);