Skip to content

Commit

Permalink
Merge pull request #1059 from ita-social-projects/develop
Browse files Browse the repository at this point in the history
Update master
  • Loading branch information
Adeodonne authored Dec 8, 2023
2 parents a732eaa + 4698a71 commit 8dd38dc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
margin-bottom: 24px;

.formTitle {
text-align: left;
@include mut.with-font($font-family: ft.$closer-text-font, $font-weight: 500, $font-size: 20px);
line-height: 26px;
color: #891F16;
Expand Down Expand Up @@ -221,7 +222,7 @@
}

@media screen and (max-width: 480px) {
.contactUsContainer .formContainer .formTitleContainer .formTitle {
.formWrapper .formTitleContainer .formTitle {
text-align: center;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ export const ContactUsModal = ({ text, toggleState}: Props) => {
className="contactUsModal"
open={isActive}
footer={null}
onCancel={() => setActive(false)}
onCancel={() => {
setActive(false);
onClear();
}}
width={"max-content"}
closable={isDesktop}
closeIcon={(isDesktop ?
<Popover content="Внесені зміни не будуть збережені!" trigger='hover'>
<CancelBtn onClick={onClear} />
<CancelBtn/>
</Popover>
: <CancelBtn onClick={onClear} />)}
: <CancelBtn/>)}
>
<ContactForm customClass={"formWrapper__modal"} ref={form} />
</Modal>
Expand Down
22 changes: 20 additions & 2 deletions src/features/AdminPage/NewsPage/NewsModal/NewsModal.component.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable react/jsx-no-duplicate-props */
/* eslint-disable complexity */
/* eslint-disable eqeqeq */
/* eslint-disable @typescript-eslint/no-unused-expressions */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-param-reassign */
import './NewsModal.styles.scss';
Expand Down Expand Up @@ -54,6 +58,7 @@ const NewsModal: React.FC<{
const sizeLimit = limit ?? 15000;
const [data, setData] = React.useState(initialValue ?? '');
const [count, setCount] = React.useState(0);
const [textCount, setTextCount] = useState(0);

const handlePreview = async (file: UploadFile) => {
setFilePreview(file);
Expand Down Expand Up @@ -224,6 +229,9 @@ const NewsModal: React.FC<{
if (cCount <= sizeLimit) {
setData(value);
setCount(cCount);
setTextCount(cCount);
} else {
callErrorMessage('Ви перевищіли максимально допустиму кількість символів');
}
};

Expand Down Expand Up @@ -294,6 +302,7 @@ const NewsModal: React.FC<{
}
return Promise.reject(new Error('Посилання вже існує'));
},

},
]}
>
Expand Down Expand Up @@ -332,8 +341,15 @@ const NewsModal: React.FC<{
}}
/>
<p>
Remaining:
{sizeLimit - count}
Залишок символів:
{' '}
{sizeLimit - textCount}
{textCount > sizeLimit && (
<span style={{ color: 'red', marginLeft: '10px' }}>
Ви перевищіли максимально допустиму кількість символів
</span>
)}

</p>
{!textIsPresent && textIsChanged && (
<p className="form-text">Введіть текст</p>
Expand All @@ -342,6 +358,7 @@ const NewsModal: React.FC<{
<Form.Item
name="image"
label="Зображення: "
rules={[{ required: true, message: 'Додайте зображення' }]}
valuePropName="fileList"
getValueFromEvent={(e: any) => {
if (Array.isArray(e)) {
Expand Down Expand Up @@ -410,6 +427,7 @@ const NewsModal: React.FC<{
<p>Виберіть чи перетягніть файл</p>
</FileUploader>
</Form.Item>

<Form.Item
name="creationDate"
label="Дата створення: "
Expand Down

0 comments on commit 8dd38dc

Please sign in to comment.