Is there a way to adjust my simple caret rotation to make it rotate from the center? What changes should I make?
const Wrap = styled.div`
width: 100px;
background: grey;
span {
display: block;
transform: ${(props) => (props.isOpen ? "rotate(0deg)" : "rotate(180deg)")};
transition: all ease-in 0.2s;
}
`;
export default function App() {
const [open, setIsOpen] = React.useState(false);
return (
<Wrap isOpen={open} className="App" onClick={() => setIsOpen(!open)}>
{open.toString()}
<span>^</span>
</Wrap>
);
}
https://codesandbox.io/s/angry-jackson-8rdcl?file=/src/App.js:90-541