Add label and bottom-margin technology
This commit is contained in:
29
src/stories/Label.tsx
Normal file
29
src/stories/Label.tsx
Normal 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;
|
||||
`;
|
@@ -11,7 +11,7 @@ interface SpaceBetweenContainerProps {
|
||||
const SpaceBetweenContainer: FC<SpaceBetweenContainerProps> = ({
|
||||
children,
|
||||
style,
|
||||
width100pct,
|
||||
width100pct = true,
|
||||
}) => {
|
||||
return (
|
||||
<StyledDiv style={style} width100pct={width100pct}>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import React, { FC, ReactNode } from "react";
|
||||
import React, { FC } from "react";
|
||||
import styled from "styled-components";
|
||||
import CSS from "csstype";
|
||||
|
||||
|
36
src/stories/TextAlignWrapper.tsx
Normal file
36
src/stories/TextAlignWrapper.tsx
Normal 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;
|
||||
`}
|
||||
`;
|
Reference in New Issue
Block a user