Add common component and helpers

This commit is contained in:
2023-10-26 16:49:16 +07:00
parent f9f5990a4a
commit bd407bb933
10 changed files with 140 additions and 5 deletions
+25 -5
View File
@@ -1,15 +1,35 @@
import styled from 'styled-components';
import styled, { css } from 'styled-components';
const Button = styled.button`
interface IButtonStyle {
styled?: 'primary' | 'secondary';
}
const Button = styled.button<IButtonStyle>`
padding: 10px 20px;
background-color: var(--primary-color);
color: var(--light-text);
text-transform: uppercase;
font-weight: 500;
font-weight: 600;
cursor: pointer;
border-radius: var(--radius-md);
${(props) =>
props.styled === 'primary' &&
css`
background-color: var(--primary-color);
color: var(--light-text);
`}
${(props) =>
props.styled === 'secondary' &&
css`
background-color: var(--secondary-btn-color);
`}
`;
Button.defaultProps = {
styled: 'primary',
};
export default Button;
@@ -0,0 +1,12 @@
import { css } from 'styled-components';
const CommonInput = css`
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
padding: 10px 20px;
font-size: var(--fs-sm-x);
width: 200px;
`;
export default CommonInput;
@@ -0,0 +1,10 @@
import styled from 'styled-components';
// Styled
import CommonInput from './CommonInput';
const Input = styled.input`
${CommonInput}
`;
export default Input;
@@ -0,0 +1,10 @@
import styled from 'styled-components';
// Styled
import CommonInput from './CommonInput';
const TextArea = styled.textarea`
${CommonInput}
`;
export default TextArea;