@meduza/ui-kit-2 0.1.76 → 0.1.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.76",
2
+ "version": "0.1.77",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -58,7 +58,6 @@
58
58
  line-height: 25px;
59
59
 
60
60
  @media $mobile {
61
- display: block;
62
61
  font-size: 29px;
63
62
  line-height: 34px;
64
63
  }
@@ -16,7 +16,8 @@ const Example: React.FC = () => {
16
16
  return (
17
17
  <>
18
18
  <div className={styles.root}>
19
- <DonatesTeaser styleContext={['center']} />
19
+ <DonatesTeaser lang="ru" styleContext={['center']} />
20
+ <DonatesTeaser lang="en" styleContext={['center']} />
20
21
  </div>
21
22
  </>
22
23
  )
@@ -1,3 +1,4 @@
1
1
  export interface DonatesTeaserProps {
2
2
  styleContext: string[] | string
3
+ lang: 'ru' | 'en'
3
4
  }
@@ -6,7 +6,8 @@ import makeStyleContext from '../utils/makeStyleContext'
6
6
  import styles from './DonatesTeaser.module.css'
7
7
 
8
8
  export const DonatesTeaser: React.FC<DonatesTeaserProps> = ({
9
- styleContext
9
+ styleContext,
10
+ lang = 'ru'
10
11
  }) => {
11
12
  let classNames: ClassNames = [[styles.root, true]]
12
13
 
@@ -14,22 +15,38 @@ export const DonatesTeaser: React.FC<DonatesTeaserProps> = ({
14
15
  classNames = makeStyleContext(classNames, styleContext, styles)
15
16
  }
16
17
 
18
+ const data = {
19
+ ru: {
20
+ title:
21
+ 'Вы&nbsp;читали &laquo;Медузу&raquo;. Вы&nbsp;слушали &laquo;Медузу&raquo;. Вы&nbsp;смотрели &laquo;Медузу&raquo;',
22
+ subtitle: 'Помогите&nbsp;нам спасти &laquo;Медузу&raquo;',
23
+ button: 'Дать денег',
24
+ href: 'https://support.meduza.io'
25
+ },
26
+ en: {
27
+ title: 'You read Meduza. You listen to&nbsp;Meduza. You follow Meduza',
28
+ subtitle: 'Help save Meduza',
29
+ button: 'Pledge today',
30
+ href: 'https://support.meduza.io/en'
31
+ }
32
+ }
33
+
17
34
  return (
18
35
  <div data-testid="donates-teaser" className={makeClassName(classNames)}>
19
36
  <div className={styles.main}>
20
37
  <h3 className={styles.title}>
21
- Вы&nbsp;читали &laquo;Медузу&raquo;. Вы&nbsp;слушали
22
- &laquo;Медузу&raquo;. Вы&nbsp;смотрели &laquo;Медузу&raquo;
38
+ <span dangerouslySetInnerHTML={{ __html: data[lang].title }} />
23
39
  {` `}
24
- <span className={styles.text}>
25
- Помогите нам спасти &laquo;Медузу&raquo;{' '}
26
- </span>
40
+ <span
41
+ className={styles.text}
42
+ dangerouslySetInnerHTML={{ __html: data[lang].subtitle }}
43
+ />
27
44
  </h3>
28
45
  </div>
29
46
 
30
47
  <div className={styles.cta}>
31
- <a href="https://support.meduza.io" target="_blank" rel="noreferrer">
32
- <span className={styles.ctaInner}>Дать денег</span>
48
+ <a href={data[lang].href} target="_blank" rel="noreferrer">
49
+ <span className={styles.ctaInner}>{data[lang].button}</span>
33
50
  </a>
34
51
  </div>
35
52
  </div>
@@ -10,4 +10,5 @@ export interface MaterialNoteProps {
10
10
  type: string
11
11
  }
12
12
  styleContext?: string | string[]
13
+ lang: 'ru' | 'en'
13
14
  }
@@ -9,6 +9,7 @@ import styles from './MaterialNote.module.css'
9
9
 
10
10
  export const MaterialNote: React.FC<MaterialNoteProps> = ({
11
11
  block: { data },
12
+ lang,
12
13
  styleContext
13
14
  }) => {
14
15
  let classNames: ClassNames = [[styles.root, true]]
@@ -19,7 +20,7 @@ export const MaterialNote: React.FC<MaterialNoteProps> = ({
19
20
 
20
21
  return (
21
22
  <>
22
- <DonatesTeaser styleContext={styleContext} />
23
+ <DonatesTeaser styleContext={styleContext} lang={lang} />
23
24
  <div data-testid="material-note" className={makeClassName(classNames)}>
24
25
  {data &&
25
26
  data.map((item) => (
@@ -120,7 +120,9 @@ export const RenderBlocks: React.FC<RenderBlocksProps> = ({
120
120
  return <GroupedBlock block={block} styleContext={styleContext} />
121
121
 
122
122
  case 'material_note':
123
- return <MaterialNote block={block} styleContext={styleContext} />
123
+ return (
124
+ <MaterialNote block={block} lang={lang} styleContext={styleContext} />
125
+ )
124
126
 
125
127
  default: {
126
128
  return null