redoc/src/common-elements/panels.ts
2023-10-24 09:12:30 +02:00

88 lines
2.2 KiB
TypeScript

import { SECTION_ATTR } from '../services/MenuStore';
import styled, { media } from '../styled-components';
export const MiddlePanel = styled.div<{ $compact?: boolean }>`
width: calc(100% - ${props => props.theme.rightPanel.width});
padding: 0 ${props => props.theme.spacing.sectionHorizontal}px;
${({ $compact, theme }) =>
media.lessThan('medium', true)`
width: 100%;
padding: ${`${$compact ? 0 : theme.spacing.sectionVertical}px ${
theme.spacing.sectionHorizontal
}px`};
`};
${({ $compact, theme }) =>
media.lessThan('small', true)`
padding: ${`${$compact ? 0 : theme.spacing.sectionVertical / 2}px ${
theme.spacing.sectionHorizontal / 2
}px`};
`};
`;
export const Section = styled.div.attrs(props => ({
[SECTION_ATTR]: props.id,
}))<{ $underlined?: boolean }>`
padding: ${props => props.theme.spacing.sectionVertical}px 0;
&:last-child {
min-height: calc(100vh + 1px);
}
& > &:last-child {
min-height: initial;
}
${media.lessThan('medium', true)`
padding: 0;
`}
${({ $underlined }) =>
($underlined &&
`
position: relative;
&:not(:last-of-type):after {
position: absolute;
bottom: 0;
width: 100%;
display: block;
content: '';
}
`) ||
''}
`;
export const RightPanel = styled.div`
width: ${props => props.theme.rightPanel.width};
color: ${({ theme }) => theme.rightPanel.textColor};
background-color: ${props => props.theme.rightPanel.backgroundColor};
padding: 0 ${props => props.theme.spacing.sectionHorizontal}px;
${media.lessThan('medium', true)`
width: 100%;
padding: ${props =>
`${props.theme.spacing.sectionVertical}px ${props.theme.spacing.sectionHorizontal}px`};
`};
${media.lessThan('small', true)`
width: 100%;
padding: ${props =>
`${props.theme.spacing.sectionVertical / 2}px ${
props.theme.spacing.sectionHorizontal / 2
}px`};
`};
`;
export const DarkRightPanel = styled(RightPanel)`
background-color: ${props => props.theme.rightPanel.backgroundColor};
`;
export const Row = styled.div`
display: flex;
width: 100%;
padding: 0;
${media.lessThan('medium', true)`
flex-direction: column;
`};
`;