-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(docs): add last time edit date #349
base: stable
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for sendsay-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
docusaurus.config.ts
Outdated
@@ -45,6 +45,7 @@ const config: Config = { | |||
docs: { | |||
routeBasePath: '/', | |||
sidebarPath: require.resolve('./sidebars.js'), | |||
showLastUpdateTime: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это новое поле, остальное это линтер отрефакторил
72ef415
to
2cd6d64
Compare
7c11115
to
76f7497
Compare
7030052
to
d0e2af4
Compare
actions.addRoute({ | ||
path: RECENT_ARTICLES_TEMP_URL, | ||
exact: true, | ||
component: '@site/src/components/RecentlyUpdatedArticles/RecentlyUpdatedArticles.js', | ||
modules: { | ||
recentArticles, | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
на моменте обработки данных мы добавляем роут и рендерим в нем компонент, данная статья недоступна пользователям, не должна показываться в поиске и не индексируется
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это компонент который мы рендерим на этой странице - его можно посмотреть по прямой ссылке
https://deploy-preview-349--sendsay-docs.netlify.app/updates/BC1ADF523
<iframe | ||
ref={iframeRef} | ||
src={RECENT_ARTICLES_TEMP_URL} | ||
name="latest-articles" | ||
className="w-full" | ||
style={{ | ||
border: 'none', | ||
outline: 'none', | ||
}} | ||
onLoad={resizeIframe} | ||
scrolling="no" | ||
seamless="seamless" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
следом нам нужен iframe который будет отображать статью в нужном нам месте (самое простое решение для того чтобы в статье был сайдбар и тайтл)
import { RecentlyUpdatedArticlesIframe } from '@site/src/components/RecentlyUpdatedArticles'; | ||
|
||
<RecentlyUpdatedArticlesIframe /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iframeRef.current?.contentWindow.document.addEventListener('redirect', handleRedirectInIframe); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
этот кастомный слушатель нужен для того чтобы при клике по ссылке внутри айфрейма мы с помощью реакта осуществили редирект внутри приложения,
если сделать history.push внутри айфрейма то мы откроем страницу в маленьком окошке iframa оставшись на странице с обновлениями документации
всякие window.parent.location.href приводили к перезагрузке страницы и терялась одностраничность приложения
8e7dfaf
to
053acaf
Compare
053acaf
to
a3f3b84
Compare
recent_article: | ||
theses: | ||
- Пример | ||
- Изменения | ||
- 24 правки текста |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
удалить перед релизом
recent_article: | ||
new: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
удалить перед релизом
это приколы с iframe он на моменте загрузки вычисляет высоту и выставляет по размеру, нужно добавить перерасчет для ресайза, спасибо |
src/components/RecentlyUpdatedArticles/RecentlyUpdatedArticles.js
Outdated
Show resolved
Hide resolved
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"tailwindcss": "^3.4.1" | ||
"tailwindcss": "^3.4.1", | ||
"html-entities": "2.5.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавил новый пакет чтобы конвертить html entities в unicode для корректного вывода в тегах html
fibery
Часть 1 - вывод тега с датой последнего обновления статьи
по умолчанию дата выводится в правом нижнем углу статьи
мы решили выводить ее в начале каждой статьи в виде тега
Часть 2 - выводим 5 последних статей на отдельной странице
сделано с референсом
для того чтобы добавить контента на страницу с выводом последних статей нужны дополнительные сведения о статье, которые будут заполнять редакторы при ее создании