-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(react-ui, react-ui-validations): add new documentation banner (#…
- Loading branch information
1 parent
67d075f
commit f2acb0c
Showing
8 changed files
with
280 additions
and
58 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
packages/react-ui-validations/docs/Common/Notification.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
export const NotificationContainer = styled.div` | ||
position: sticky; | ||
z-index: 2; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
align-items: flex-start; | ||
box-sizing: border-box; | ||
width: 100%; | ||
margin: 0 auto; | ||
padding: 16px 24px; | ||
background: #ff4785; | ||
color: white; | ||
font-size: 16px; | ||
line-height: 1.375; | ||
@media screen and (min-width: 768px) { | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
`; | ||
|
||
export const NotificationContent = styled.div` | ||
max-width: 1080px; | ||
a { | ||
color: white; | ||
} | ||
`; | ||
|
||
export const NotificationButton = styled.a` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 8px 16px; | ||
border-radius: 6px; | ||
background: #fff; | ||
opacity: 0.955; | ||
color: #222222; | ||
font-size: 16px; | ||
font-family: inherit; | ||
text-decoration: none; | ||
transition: 0.15s ease; | ||
&:hover { | ||
opacity: 1; | ||
} | ||
&:active { | ||
opacity: 0.92; | ||
} | ||
`; | ||
|
||
export function Notification() { | ||
return ( | ||
<NotificationContainer> | ||
<NotificationContent> | ||
<b>Делаем новую доку.</b> Собираем в ней все наши пакеты, уже сделали навигацию по разделам, управление | ||
фича-флагами и добавили песочницу для валидаций. Тестируем и собираем обратную связь | ||
до конца года. Используйте новую доку и рассказывайте нам в | ||
<a href="https://chat.skbkontur.ru/kontur/channels/new-documentation-react-ui" target="_blank"> | ||
Маттермосте | ||
</a>{' '} | ||
как она вам. | ||
</NotificationContent> | ||
<NotificationButton href="https://ui.gitlab-pages.kontur.host/storybook-documentation/" target="_blank"> | ||
Попробовать | ||
</NotificationButton> | ||
</NotificationContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const checkNewDocsAccess = (): Promise<boolean> => { | ||
return new Promise((resolve) => { | ||
fetch('https://ui.gitlab-pages.kontur.host/storybook-documentation/', { | ||
mode: 'cors', | ||
}) | ||
.then((response) => { | ||
if (response.ok) { | ||
resolve(true); | ||
} else { | ||
resolve(false); | ||
} | ||
}) | ||
.catch(() => { | ||
resolve(false); | ||
}); | ||
}); | ||
}; |
65 changes: 65 additions & 0 deletions
65
packages/react-ui/.styleguide/components/Notification/Notification.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { css, memoizeStyle } from '../../../lib/theming/Emotion'; | ||
|
||
export const styles = memoizeStyle({ | ||
notification() { | ||
return css` | ||
position: sticky; | ||
z-index: 2; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
align-items: flex-start; | ||
box-sizing: border-box; | ||
width: 100%; | ||
margin: 0 auto; | ||
padding: 16px 24px; | ||
background: #ff4785; | ||
color: white; | ||
font-size: 16px; | ||
line-height: 1.375; | ||
@media screen and (min-width: 768px) { | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
`; | ||
}, | ||
notificationContent() { | ||
return css` | ||
max-width: 1080px; | ||
a { | ||
color: white; | ||
} | ||
`; | ||
}, | ||
notificationButton() { | ||
return css` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 8px 16px; | ||
border-radius: 6px; | ||
background: #fff; | ||
opacity: 0.955; | ||
color: #222222; | ||
font-size: 16px; | ||
font-family: inherit; | ||
text-decoration: none; | ||
transition: 0.15s ease; | ||
@media (hover) { | ||
&:hover { | ||
opacity: 1; | ||
} | ||
} | ||
&:active { | ||
opacity: 0.92; | ||
} | ||
`; | ||
}, | ||
}); |
28 changes: 28 additions & 0 deletions
28
packages/react-ui/.styleguide/components/Notification/Notification.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
|
||
import { cx } from '../../../lib/theming/Emotion'; | ||
|
||
import { styles } from './Notification.styles'; | ||
|
||
export function Notification() { | ||
return ( | ||
<div className={cx(styles.notification())}> | ||
<div className={cx(styles.notificationContent())}> | ||
<b>Делаем новую доку.</b> Собираем в ней все наши пакеты, уже сделали навигацию по разделам, управление | ||
фича-флагами и добавили песочницу для валидаций. Тестируем и собираем обратную связь | ||
до конца года. Используйте новую доку и рассказывайте нам в | ||
<a href="https://chat.skbkontur.ru/kontur/channels/new-documentation-react-ui" target="_blank"> | ||
Маттермосте | ||
</a>{' '} | ||
как она вам. | ||
</div> | ||
<a | ||
href="https://ui.gitlab-pages.kontur.host/storybook-documentation/" | ||
className={cx(styles.notificationButton())} | ||
target="_blank" | ||
> | ||
Попробовать | ||
</a> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/react-ui/.styleguide/components/Notification/checkNewDocsAccess.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const checkNewDocsAccess = (): Promise<boolean> => { | ||
return new Promise((resolve) => { | ||
fetch('https://ui.gitlab-pages.kontur.host/storybook-documentation/', { | ||
mode: 'cors', | ||
}) | ||
.then((response) => { | ||
if (response.ok) { | ||
resolve(true); | ||
} else { | ||
resolve(false); | ||
} | ||
}) | ||
.catch(() => { | ||
resolve(false); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.