Skip to content

Commit c0fd8aa

Browse files
authored
Merge pull request #463 from bluewave-labs/458-formik-and-yup-validations-for-link-fe
458 formik and yup validations for link fe
2 parents d6cc068 + 84b6a9c commit c0fd8aa

File tree

13 files changed

+610
-339
lines changed

13 files changed

+610
-339
lines changed

frontend/.eslintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"ecmaVersion": 2015,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:react/recommended",
6+
"plugin:storybook/recommended",
7+
"prettier"
8+
],
9+
"plugins": ["prettier"],
10+
"rules": {
11+
"prettier/prettier": "error"
12+
}
13+
}

frontend/package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@testing-library/react": "^15.0.7",
4242
"@testing-library/user-event": "^14.5.2",
4343
"eslint": "^8.57.0",
44+
"eslint-config-prettier": "^9.1.0",
4445
"eslint-plugin-react": "^7.34.1",
4546
"eslint-plugin-react-hooks": "^4.6.0",
4647
"eslint-plugin-storybook": "^0.8.0",

frontend/src/.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"trailingComma": "es5",
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"bracketSpacing": true,
7+
"arrowParens":"always",
8+
"htmlWhitespaceSensitivity": "strict"
9+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
$appearance-width: 194px;
2+
$circle-size: 24px;
3+
$input-height: 1.4rem;
4+
$box-shadow-color: rgba(16, 24, 40, 0.05);
5+
6+
.appearance {
7+
width: 50%;
8+
padding: 20px 0;
9+
margin-right: 2rem;
10+
11+
&__label {
12+
display: flex;
13+
flex-direction: column;
14+
margin-bottom: 1rem;
15+
width: fit-content;
16+
font-size: 0.813rem;
17+
font-weight: 400;
18+
line-height: 1.54;
19+
}
20+
21+
&__input {
22+
width: $appearance-width;
23+
padding: 0.313rem;
24+
border: 1px solid var(--light-border-color);
25+
box-shadow: 0px 1px 2px 0px $box-shadow-color;
26+
height: $input-height;
27+
border-radius: 0.5rem;
28+
display: inline-block;
29+
font-size: var(--font-regular);
30+
color: var(--main-text-color);
31+
font-family: Inter;
32+
33+
&:first-of-type {
34+
margin-top: 5px;
35+
}
36+
}
37+
38+
&__color {
39+
margin: 5px 0 0;
40+
width: 100%;
41+
background-color: #fff;
42+
display: flex;
43+
align-items: center;
44+
}
45+
46+
&__circle {
47+
width: $circle-size;
48+
height: $circle-size;
49+
border-radius: 50%;
50+
padding: 0;
51+
background-color: transparent;
52+
position: relative;
53+
margin-left: 9px;
54+
55+
& input {
56+
position: absolute;
57+
top: 2px;
58+
left: 2px;
59+
width: 100%;
60+
height: 100%;
61+
border-radius: 50%;
62+
}
63+
64+
&--mask {
65+
display: block;
66+
position: relative;
67+
z-index: 2;
68+
width: 24px;
69+
height: 24px;
70+
border-radius: 50%;
71+
border: 1.5px solid #000;
72+
}
73+
}
74+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import PropTypes from 'prop-types';
2+
import styles from './ColorInput.module.scss';
3+
4+
const ColorInput = ({ id, name, value, onChange, onBlur, error, title, className }) => (
5+
<label htmlFor="header-bg" className={styles.appearance__label}>
6+
{title}{' '}
7+
<div className={styles.appearance__color}>
8+
<span
9+
className={`${styles.appearance__input} ${styles[className]} ${
10+
error && styles.error
11+
}`}
12+
>
13+
{value}
14+
</span>
15+
<div className={styles.appearance__circle}>
16+
<input
17+
type="color"
18+
id={id}
19+
name={name}
20+
value={value}
21+
onChange={onChange}
22+
onBlur={onBlur}
23+
/>
24+
<span
25+
className={styles['appearance__circle--mask']}
26+
style={{ backgroundColor: value }}
27+
/>
28+
</div>
29+
</div>
30+
</label>
31+
);
32+
33+
export default ColorInput;
34+
35+
ColorInput.propTypes = {
36+
id: PropTypes.string.isRequired,
37+
name: PropTypes.string.isRequired,
38+
value: PropTypes.string.isRequired,
39+
onChange: PropTypes.func.isRequired,
40+
onBlur: PropTypes.func.isRequired,
41+
error: PropTypes.string,
42+
title: PropTypes.string,
43+
};

0 commit comments

Comments
 (0)