Add label and bottom-margin technology

This commit is contained in:
2021-09-19 23:23:51 -04:00
parent 2442a6b9bc
commit 3d2a2ac724
8 changed files with 87 additions and 5 deletions

29
src/stories/Label.tsx Normal file
View File

@@ -0,0 +1,29 @@
import React, { FC, ReactNode } from "react";
import styled from "styled-components";
import CSS from "csstype";
import { typography } from "../shared/styles";
export interface LabelProps {
children: ReactNode | null;
style?: CSS.Properties;
htmlFor: string;
}
const Label: FC<LabelProps> = ({ children, style, htmlFor }) => {
return (
<StyledLabel style={style} htmlFor={htmlFor}>
{children}
</StyledLabel>
);
};
export default Label;
const StyledLabel = styled.label<LabelProps>`
font-size: 1.4rem;
font-family: ${typography.regular};
font-weight: ${typography.weight.heavy};
margin-bottom: 0.7rem;
`;

View File

@@ -11,7 +11,7 @@ interface SpaceBetweenContainerProps {
const SpaceBetweenContainer: FC<SpaceBetweenContainerProps> = ({
children,
style,
width100pct,
width100pct = true,
}) => {
return (
<StyledDiv style={style} width100pct={width100pct}>

View File

@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import React, { FC } from "react";
import styled from "styled-components";
import CSS from "csstype";

View File

@@ -0,0 +1,36 @@
import React, { FC, ReactNode } from "react";
import styled, { css } from "styled-components";
import CSS from "csstype";
interface TextAlignWrapperProps {
children: ReactNode | null;
style?: CSS.Properties;
align: "left" | "center" | "right";
marginBottom?: boolean;
}
const TextAlignWrapper: FC<TextAlignWrapperProps> = ({
children,
style,
align = "left",
marginBottom = true,
}) => {
return (
<StyledDiv style={style} align={align} marginBottom={marginBottom}>
{children}
</StyledDiv>
);
};
export default TextAlignWrapper;
const StyledDiv = styled.div<TextAlignWrapperProps>`
text-align: ${(props) => props.align};
width: 100%;
${(props) =>
props.marginBottom &&
css`
margin-bottom: 0.7rem;
`}
`;