@navinc/base-react-components
Version:
Nav's Pattern Library
58 lines (55 loc) • 2.18 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import styled from 'styled-components';
import { Copy } from './copy.js';
import { Header } from './header.js';
const Label = styled(Copy).withConfig({ displayName: "brc-sc-Label", componentId: "brc-sc-1wlhkim" }) ``;
const LabelAlignmentWrapper = styled.div.withConfig({ displayName: "brc-sc-LabelAlignmentWrapper", componentId: "brc-sc-8oap77" }) `
display: flex;
height: 30px;
align-items: flex-end;
`;
const Value = styled(Header).attrs(() => ({ size: 'md', as: Copy })).withConfig({ displayName: "brc-sc-Value", componentId: "brc-sc-a2umut" }) `
min-height: 30px;
word-break: break-word;
font-weight: 800;
`;
const Wrapper = styled.div.withConfig({ displayName: "brc-sc-Wrapper", componentId: "brc-sc-19v3wgr" }) `
width: 122px;
max-width: 270px;
display: flex;
flex-flow: column nowrap;
border-bottom: solid 1px none;
border-top: solid 1px none;
padding-bottom: 16px;
padding-top: 16px;
flex-grow: 1;
`;
const Container = styled.div.withConfig({ displayName: "brc-sc-Container", componentId: "brc-sc-zkg2rl" }) `
display: flex;
flex-flow: row wrap;
align-items: stretch;
${({ borderColor }) => (borderColor ? `border: 1px solid ${borderColor}` : '')};
border-radius: 4px;
padding: 16px;
flex-grow: ${({ length = 1 }) => length};
flex-shrink: ${({ length = 1 }) => length};
margin-top: -16px; /* these margin-tops are to give space between rows when they wrap */
margin-right: -16px;
& > * {
margin-right: 16px;
margin-top: 16px;
}
& > & {
margin-top: 16px;
margin-right: 16px;
& > ${Wrapper} {
margin-top: 0;
border: none;
padding-bottom: 0;
padding-top: 0;
}
}
`;
export const LabelOverValue = ({ value = '', label = '' }) => (_jsxs(Wrapper, { children: [_jsx(LabelAlignmentWrapper, { children: _jsx(Label, { size: "md", children: label }) }), _jsx(Value, { children: value })] }));
export const LabelOverValueContainer = ({ children = [], borderColor }) => (_jsx(Container, { length: children.length, borderColor: borderColor, children: children }));
//# sourceMappingURL=label-over-value.js.map