import styled, { css } from 'styled-components'; const position: { [index: string]: string } = { left: ` top: 0; bottom: 0; left: 0; right: auto; `, top: ` top: 0; bottom: auto; left: 0; right: 0; `, right: ` top: 0; bottom: 0; left: auto; right: 0; `, bottom: ` top: auto; bottom: 0; left: 0; right: 0; `, }; const close: { [index: string]: string } = { left: ` transform: translate(-267px, 0); `, top: ` transform: translate(0, -267px); `, right: ` transform: translate(267px, 0); `, bottom: ` transform: translate(0, 267px); `, }; export const Slide = styled('div')<{ open: boolean; anchor: string; zIndex: number; }>` position: fixed; transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms; z-index: ${(props) => props.zIndex}; background-color: white; ${(props) => position[props.anchor]} ${(props) => props.open ? css` transform: translate(0, 0); ` : close[props.anchor]} `; export const Wrapper = styled.div` min-width: 267px; min-height: 267px; height: 100%; width: 100%; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.24); -ms-overflow-style: none; overflow: auto; `;