Skip to content

Commit e2198e7

Browse files
committed
Merge branch 'develop' of github.com:typeofweb/polskifrontend into table
2 parents 891592b + 4fa0b70 commit e2198e7

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

components/UpdateBlogSection/UpdateBlogForm.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export const UpdateBlogForm = memo<Props>(({ blogId }) => {
2828
const [isValid, setIsValid] = useState(false);
2929
const formRef = useRef<HTMLFormElement | null>(null);
3030

31+
useEffect(() => {
32+
setIsValid(formRef.current?.checkValidity() ?? false);
33+
}, [fields]);
34+
3135
useEffect(() => {
3236
if (queryStatus === 'success' && blog) {
3337
setFields(blog);
@@ -36,7 +40,6 @@ export const UpdateBlogForm = memo<Props>(({ blogId }) => {
3640

3741
const handleChange: ChangeEventHandler<HTMLInputElement> = useCallback(({ currentTarget }) => {
3842
setFields((fields) => ({ ...fields, [currentTarget.name]: currentTarget.value }));
39-
setIsValid(formRef.current?.checkValidity() ?? false);
4043
}, []);
4144

4245
const handleInputCheckboxChange: ChangeEventHandler<HTMLInputElement> = useCallback(
@@ -118,7 +121,6 @@ export const UpdateBlogForm = memo<Props>(({ blogId }) => {
118121
name="isPublic"
119122
onChange={handleInputCheckboxChange}
120123
type="checkbox"
121-
required
122124
/>
123125
Czy blog ma być pokazany na stronie?
124126
</label>

components/UpdateBlogSection/updateBlogForm.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
display: flex;
4242
margin-right: 0.75rem;
4343
}
44+
45+
&:read-only {
46+
background-color: var(--reddish-white);
47+
border: 1px solid var(--reddish-white);
48+
}
4449
}
4550

4651
.submitButton {

global.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
--gray-text: #757575;
1010
--gray-dark-border: #999999;
1111
--white: #ffffff;
12+
--reddish-white: #faf9f8;
1213
--black: #000000;
1314
--black-lighter: #{lighten(#000000, 20%)};
1415
--error-color: #f16262;

0 commit comments

Comments
 (0)