Fixed imports all components
This commit is contained in:
15
src/utils/constants.js
Normal file
15
src/utils/constants.js
Normal file
@ -0,0 +1,15 @@
|
||||
export const LEVELS = {
|
||||
1: 'Junior',
|
||||
2: 'Middle',
|
||||
3: 'Middle+',
|
||||
4: 'Senior',
|
||||
};
|
||||
|
||||
export const SKILLS = {
|
||||
1: 'Back end - разработчик',
|
||||
2: 'Front end - разработчик',
|
||||
3: 'Маркетолог',
|
||||
4: 'Smm - специалист',
|
||||
5: 'Дизайнер',
|
||||
6: 'Копирайтер',
|
||||
};
|
53
src/utils/helper.js
Normal file
53
src/utils/helper.js
Normal file
@ -0,0 +1,53 @@
|
||||
export function createMarkup(text) {
|
||||
return { __html: text.split("</p>").join("</p>") };
|
||||
}
|
||||
|
||||
export function transformHtml(text) {
|
||||
let startHtml = {
|
||||
__html: text.split("<h3> || <h2>").join("<br><h2>").split("<br>"),
|
||||
};
|
||||
startHtml = startHtml.__html.filter(
|
||||
(el) => (el !== null && el !== "") || el === 0
|
||||
);
|
||||
const finalHtml = startHtml.map(
|
||||
(item) =>
|
||||
`<div class='experience__block'>
|
||||
<div class="summary__sections__head">
|
||||
<h3>Описание опыта работы</h3>
|
||||
<button>Редактировать раздел</button>
|
||||
</div>
|
||||
<div class="experience__content">${item.split("<h3>")[0]}</div>
|
||||
</div>`
|
||||
);
|
||||
return { __html: finalHtml.join("") };
|
||||
}
|
||||
//
|
||||
// export const setToken = () => {
|
||||
// const url = new URL(window.location.href);
|
||||
// const urlT = url.searchParams.get("token");
|
||||
// urlT ? sessionStorage.setItem('token', 'Bearer ' + urlT) : '';
|
||||
// const tParam = urlT || sessionStorage.getItem('token');
|
||||
// return tParam ? {"Authorization": tParam} : false
|
||||
//
|
||||
// };
|
||||
|
||||
export const getToken = () => {
|
||||
const tParam = `Bearer ${localStorage.getItem("auth_token")}`;
|
||||
|
||||
return tParam ? { Authorization: tParam } : {};
|
||||
};
|
||||
|
||||
export const urlHasParams = (url) =>
|
||||
url.indexOf("?") > 0
|
||||
? `${url}&${window.location.search.substr(1)}`
|
||||
: `${url}${window.location.search}`;
|
||||
|
||||
export const urlForLocal = (url) =>
|
||||
process.env.NODE_ENV === "development" ? `https://itguild.info${url}` : url;
|
||||
|
||||
export function scrollToForm() {
|
||||
window.scrollTo({
|
||||
top: 850,
|
||||
behavior: "smooth",
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user