@redocly/theme
Version:
Shared UI components lib
76 lines (66 loc) • 2.06 kB
text/typescript
import styled, { css } from 'styled-components';
import { breakpoints } from '@redocly/theme/core/utils';
import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
const StyledChangeViewButton = styled.span<{ collapsedSidebar?: boolean }>`
display: flex;
position: relative;
flex-direction: ${({ collapsedSidebar }) => (collapsedSidebar ? 'column' : 'row')};
justify-content: center;
align-items: center;
cursor: pointer;
border-radius: var(--border-radius);
background: var(--segmented-buttons-bg-color-main);
z-index: 1;
padding: calc(var(--spacing-unit) / 2);
`;
const StyledChangeViewButtonWrap = styled(Tooltip)<{ active?: boolean }>`
width: 20px;
height: 20px;
border-radius: var(--border-radius);
display: flex;
align-items: center;
justify-content: center;
background-color: ${({ active }) => active && 'var(--segmented-buttons-bg-color-inner)'};
`;
const ControlsWrap = styled.span<{
iconCount?: number;
isCollapsed?: boolean;
}>`
display: none;
justify-content: flex-end;
bottom: 0;
flex-direction: row;
gap: var(--spacing-xs);
align-items: center;
margin-left: var(--sidebar-controls-margin-left);
z-index: 2;
background: var(--sidebar-bg-color);
${({ isCollapsed }) =>
isCollapsed &&
css`
flex-direction: column;
margin-left: 0;
gap: var(--sidebar-controls-collapsed-gap);
padding: var(--sidebar-controls-collapsed-padding-vertical)
var(--sidebar-controls-collapsed-padding-horizontal);
`}
@media screen and (min-width: ${breakpoints.small}) {
display: flex;
}
@media print {
display: none;
}
`;
const ControlsWrapChangeLayoutButtons = styled.span<{ isCollapsed?: boolean }>`
display: flex;
bottom: 0;
flex-direction: ${({ isCollapsed }) => (isCollapsed ? 'column-reverse' : 'row')};
gap: ${({ isCollapsed }) => (isCollapsed ? '10px' : 'var(--spacing-xs)')};
align-items: center;
`;
export {
StyledChangeViewButton,
StyledChangeViewButtonWrap,
ControlsWrapChangeLayoutButtons,
ControlsWrap,
};