Skip to content

Commit

Permalink
add package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatyana-js committed May 28, 2024
1 parent e89bca0 commit 9e8d34e
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="row">
<div class="col-md-10 col-lg-8 mx-auto text-white">
<h1 class="display-3 mb-0">RSS агрегатор</h1>
<p class="lead">Начните читать RSS СЕГОДНЯ! Это легко, это красиво.</p>
<p class="lead">Начните читать RSS сегодня! Это легко, это красиво.</p>
<form action class="rss-form text-body">
<div class="row">
<div class="col">
Expand All @@ -26,7 +26,7 @@ <h1 class="display-3 mb-0">RSS агрегатор</h1>
</div>
</div>
</form>
<p class="mt-2 mb-0 text-muted">Пример: https://lorem-rss.hexlet.app/feed</p>
<p class="mt-2 mb-0 text-body-secondary">Пример: https://lorem-rss.hexlet.app/feed</p>
<p class="feedback m-0 position-absolute small text-danger"></p>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"axios": "^1.7.2",
"bootstrap": "^5.3.3",
"i18next": "^23.11.5",
"on-change": "^5.0.1",
"yup": "^1.4.0"
}
}
8 changes: 7 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18next from "i18next";
import i18next from 'i18next';
import * as yup from 'yup';
import axios from 'axios';
import validate, { proxyObj } from './utils.js';
Expand All @@ -15,7 +15,13 @@ export default () => {
});

const elements = {
title: document.querySelector('h1'),
subtitle: document.querySelector('.lead'),
form: document.querySelector('form'),
input: document.getElementById('url-input'),
label: document.querySelector('[for="url-input"]'),
example: document.querySelector('.text-muted'),
button: document.querySelector('[type="submit"]'),
};

const state = {
Expand Down
7 changes: 6 additions & 1 deletion src/locales/ru.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export default {
translation: {
title: 'RSS агрегатор',
subtitle: 'Начните читать RSS сегодня! Это легко, это красиво.',
label: 'Ссылка RSS',
example: 'Пример: https://ru.hexlet.io/lessons.rss',
button: 'Добавить',
errors: {
required: 'Заполните это поле',
existsRss: 'RSS уже существует',
invalidRss: 'Ресурс не содержит валидный RSS'
invalidRss: 'Ресурс не содержит валидный RSS',
},
},
};
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const validate = (url, urlFeeds) => {
.string()
.trim()
.required()
.notOneOf(urlFeeds, 'Ресурс не содержит валидный RSS'),
.notOneOf(urlFeeds),
});
return schema.validate({ url });
};
Expand Down
11 changes: 9 additions & 2 deletions src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ export default (elements, i18n, state) => {
const { t } = i18n;

const watchedState = onChange(state, (path, value) => {

Check failure on line 6 in src/view.js

View workflow job for this annotation

GitHub Actions / build (18.x)

'value' is defined but never used

if (path === 'isValid') {
/* empty */
} else if (path === 'errors') {
// прописать ошибки//
}
});
const renderForm = () => {

Object.entries(elements).forEach(([key, value]) => {
const element = value;
element.textContent = t(`${key}`) ?? '';
});
};
return {
watchedState,
Expand Down

0 comments on commit 9e8d34e

Please sign in to comment.