redoc/src/components/Endpoint/styled.elements.ts

77 lines
2.3 KiB
TypeScript
Raw Normal View History

import styled, { withProps } from '../../styled-components';
2017-10-12 00:01:37 +03:00
export const OperationEndpointWrap = styled.div`
cursor: pointer;
position: relative;
2018-02-22 19:48:50 +03:00
margin-bottom: 5px;
2017-10-12 00:01:37 +03:00
`;
2017-11-22 11:57:51 +03:00
export const ServerRelativeURL = styled.span`
2018-07-19 13:05:53 +03:00
font-family: ${props => props.theme.typography.headings.fontFamily};
2017-11-22 11:57:51 +03:00
margin-left: 10px;
`;
export const EndpointInfo = withProps<{ expanded?: boolean; inverted?: boolean }>(styled.div)`
padding: 10px 30px 10px ${props => (props.inverted ? '10px' : '20px')};
border-radius: ${props => (props.inverted ? '0' : '4px 4px 0 0')};
background-color: ${props => (props.inverted ? 'transparent' : '#222d32')};
2017-10-12 00:01:37 +03:00
display: block;
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
2017-11-22 11:57:51 +03:00
border: ${props => (props.inverted ? '0' : '1px solid transparent')};
border-bottom: ${props => (props.inverted ? '1px solid #ccc' : '0')};
2017-10-12 00:01:37 +03:00
transition: border-color 0.25s ease;
2018-07-19 13:05:53 +03:00
${props =>
(props.expanded && !props.inverted && `border-color: ${props.theme.colors.border.dark};`) || ''}
2017-11-22 11:57:51 +03:00
.${ServerRelativeURL} {
2018-07-19 13:05:53 +03:00
color: ${props => (props.inverted ? props.theme.colors.text.primary : '#ffffff')}
2017-11-22 11:57:51 +03:00
}
2017-10-12 00:01:37 +03:00
`;
export const HttpVerb = withProps<{ type: string }>(styled.span).attrs({
className: props => `http-verb ${props.type}`,
})`
font-size: 0.929em;
line-height: 20px;
background-color: ${props => props.theme.colors.http[props.type] || '#999999'};
color: #ffffff;
padding: 3px 10px;
text-transform: uppercase;
2018-07-19 13:05:53 +03:00
font-family: ${props => props.theme.typography.headings.fontFamily};
2017-10-12 00:01:37 +03:00
margin: 0;
`;
export const ServersOverlay = withProps<{ expanded: boolean }>(styled.div)`
position: absolute;
width: 100%;
z-index: 100;
background: #fafafa;
color: #263238;
box-sizing: border-box;
2017-11-22 11:57:51 +03:00
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.33);
2017-10-12 00:01:37 +03:00
overflow: hidden;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
transition: all 0.25s ease;
${props => (props.expanded ? '' : 'transform: translateY(-50%) scaleY(0);')}
`;
export const ServerItem = styled.div`
padding: 10px;
`;
export const ServerUrl = styled.div`
padding: 5px;
border: 1px solid #ccc;
background: #fff;
word-break: break-all;
2018-07-19 13:05:53 +03:00
color: ${props => props.theme.colors.primary.main};
2017-10-12 00:01:37 +03:00
> span {
2018-07-19 13:05:53 +03:00
color: ${props => props.theme.colors.text.primary};
2017-10-12 00:01:37 +03:00
}
`;