@redneckz/wildless-cms-uni-blocks 0.6.42 → 0.6.44
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/bin/migration-scripts/0.6.34.js +2 -0
- package/bin/migration-scripts/0.6.43.js +29 -0
- package/bundle/ProjectSettings.d.ts +2 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +122 -91
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/bundle/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/bundle/components/ProductTile/renderBenefit.d.ts +4 -0
- package/bundle/components/ProductTile/renderImage.d.ts +3 -0
- package/bundle/content-page-repository/transformImg.d.ts +1 -1
- package/bundle/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/bundle/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/bundle/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/bundle/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/bundle/utils/normalizeURLPath.d.ts +1 -0
- package/bundle/utils/url.d.ts +1 -0
- package/dist/ProjectSettings.d.ts +2 -0
- package/dist/ProjectSettings.js +5 -0
- package/dist/ProjectSettings.js.map +1 -1
- package/dist/api/LikeAPI.js +2 -2
- package/dist/api/LikeAPI.js.map +1 -1
- package/dist/components/Header/Header.js +1 -6
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/ProductTile/ProductTile.js +9 -22
- package/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/dist/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/dist/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/dist/components/ProductTile/renderAdditionalDescription.js +18 -0
- package/dist/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/dist/components/ProductTile/renderBenefit.d.ts +4 -0
- package/dist/components/ProductTile/renderBenefit.js +32 -0
- package/dist/components/ProductTile/renderBenefit.js.map +1 -0
- package/dist/components/ProductTile/renderImage.d.ts +3 -0
- package/dist/components/ProductTile/renderImage.js +12 -0
- package/dist/components/ProductTile/renderImage.js.map +1 -0
- package/dist/components/TextBlock/TextBlock.js +13 -28
- package/dist/components/TextBlock/TextBlock.js.map +1 -1
- package/dist/content-page-repository/transformImg.d.ts +1 -1
- package/dist/content-page-repository/transformImg.js +4 -10
- package/dist/content-page-repository/transformImg.js.map +1 -1
- package/dist/content-page-repository/transformMarkdown.js +3 -3
- package/dist/content-page-repository/transformMarkdown.js.map +1 -1
- package/dist/hooks/useLink.js +3 -5
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/hooks/useLocation.js +11 -5
- package/dist/hooks/useLocation.js.map +1 -1
- package/dist/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/dist/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/dist/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/dist/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/dist/services/sitemap/isHrefActive.js +2 -3
- package/dist/services/sitemap/isHrefActive.js.map +1 -1
- package/dist/setup-fixture.js +3 -3
- package/dist/setup-fixture.js.map +1 -1
- package/dist/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/dist/ui-kit/MarkdownText/MarkdownText.js +9 -0
- package/dist/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/dist/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/dist/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/dist/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/dist/ui-kit/Text/Text.js +1 -5
- package/dist/ui-kit/Text/Text.js.map +1 -1
- package/dist/utils/normalizeURLPath.d.ts +1 -0
- package/dist/utils/normalizeURLPath.js +12 -0
- package/dist/utils/normalizeURLPath.js.map +1 -0
- package/dist/utils/url.d.ts +1 -0
- package/dist/utils/url.js +9 -1
- package/dist/utils/url.js.map +1 -1
- package/dist/wlc.json +3 -1
- package/lib/ProjectSettings.d.ts +2 -0
- package/lib/ProjectSettings.js +5 -0
- package/lib/ProjectSettings.js.map +1 -1
- package/lib/api/LikeAPI.js +2 -2
- package/lib/api/LikeAPI.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Header/Header.js +1 -6
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/ProductTile/ProductTile.js +10 -23
- package/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/lib/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/lib/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/lib/components/ProductTile/renderAdditionalDescription.js +15 -0
- package/lib/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/lib/components/ProductTile/renderBenefit.d.ts +4 -0
- package/lib/components/ProductTile/renderBenefit.js +29 -0
- package/lib/components/ProductTile/renderBenefit.js.map +1 -0
- package/lib/components/ProductTile/renderImage.d.ts +3 -0
- package/lib/components/ProductTile/renderImage.js +9 -0
- package/lib/components/ProductTile/renderImage.js.map +1 -0
- package/lib/components/TextBlock/TextBlock.js +13 -28
- package/lib/components/TextBlock/TextBlock.js.map +1 -1
- package/lib/content-page-repository/transformImg.d.ts +1 -1
- package/lib/content-page-repository/transformImg.js +4 -10
- package/lib/content-page-repository/transformImg.js.map +1 -1
- package/lib/content-page-repository/transformMarkdown.js +3 -3
- package/lib/content-page-repository/transformMarkdown.js.map +1 -1
- package/lib/hooks/useLink.js +3 -5
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/hooks/useLocation.js +11 -5
- package/lib/hooks/useLocation.js.map +1 -1
- package/lib/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/lib/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/lib/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/lib/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/lib/services/sitemap/isHrefActive.js +3 -4
- package/lib/services/sitemap/isHrefActive.js.map +1 -1
- package/lib/setup-fixture.js +3 -3
- package/lib/setup-fixture.js.map +1 -1
- package/lib/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/lib/ui-kit/MarkdownText/MarkdownText.js +7 -0
- package/lib/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/lib/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/lib/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/lib/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/lib/ui-kit/Text/Text.js +1 -5
- package/lib/ui-kit/Text/Text.js.map +1 -1
- package/lib/utils/normalizeURLPath.d.ts +1 -0
- package/lib/utils/normalizeURLPath.js +9 -0
- package/lib/utils/normalizeURLPath.js.map +1 -0
- package/lib/utils/url.d.ts +1 -0
- package/lib/utils/url.js +7 -0
- package/lib/utils/url.js.map +1 -1
- package/lib/wlc.json +3 -1
- package/mobile/bundle/ProjectSettings.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +39 -21
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/mobile/bundle/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/mobile/bundle/components/ProductTile/renderBenefit.d.ts +4 -0
- package/mobile/bundle/components/ProductTile/renderImage.d.ts +3 -0
- package/mobile/bundle/content-page-repository/transformImg.d.ts +1 -1
- package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/mobile/bundle/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/mobile/bundle/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/mobile/bundle/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/mobile/bundle/utils/normalizeURLPath.d.ts +1 -0
- package/mobile/bundle/utils/url.d.ts +1 -0
- package/mobile/dist/ProjectSettings.d.ts +2 -0
- package/mobile/dist/ProjectSettings.js +5 -0
- package/mobile/dist/ProjectSettings.js.map +1 -1
- package/mobile/dist/api/LikeAPI.js +2 -2
- package/mobile/dist/api/LikeAPI.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTile.js +9 -22
- package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/mobile/dist/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/mobile/dist/components/ProductTile/renderAdditionalDescription.js +18 -0
- package/mobile/dist/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/mobile/dist/components/ProductTile/renderBenefit.d.ts +4 -0
- package/mobile/dist/components/ProductTile/renderBenefit.js +32 -0
- package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -0
- package/mobile/dist/components/ProductTile/renderImage.d.ts +3 -0
- package/mobile/dist/components/ProductTile/renderImage.js +12 -0
- package/mobile/dist/components/ProductTile/renderImage.js.map +1 -0
- package/mobile/dist/content-page-repository/transformImg.d.ts +1 -1
- package/mobile/dist/content-page-repository/transformImg.js +4 -10
- package/mobile/dist/content-page-repository/transformImg.js.map +1 -1
- package/mobile/dist/content-page-repository/transformMarkdown.js +3 -3
- package/mobile/dist/content-page-repository/transformMarkdown.js.map +1 -1
- package/mobile/dist/hooks/useLink.js +3 -5
- package/mobile/dist/hooks/useLink.js.map +1 -1
- package/mobile/dist/hooks/useLocation.js +11 -5
- package/mobile/dist/hooks/useLocation.js.map +1 -1
- package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/mobile/dist/services/sitemap/isHrefActive.js +2 -3
- package/mobile/dist/services/sitemap/isHrefActive.js.map +1 -1
- package/mobile/dist/setup-fixture.js +3 -3
- package/mobile/dist/setup-fixture.js.map +1 -1
- package/mobile/dist/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownText.js +9 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/mobile/dist/ui-kit/Text/Text.js +1 -5
- package/mobile/dist/ui-kit/Text/Text.js.map +1 -1
- package/mobile/dist/utils/normalizeURLPath.d.ts +1 -0
- package/mobile/dist/utils/normalizeURLPath.js +12 -0
- package/mobile/dist/utils/normalizeURLPath.js.map +1 -0
- package/mobile/dist/utils/url.d.ts +1 -0
- package/mobile/dist/utils/url.js +9 -1
- package/mobile/dist/utils/url.js.map +1 -1
- package/mobile/dist/wlc.json +3 -1
- package/mobile/lib/ProjectSettings.d.ts +2 -0
- package/mobile/lib/ProjectSettings.js +5 -0
- package/mobile/lib/ProjectSettings.js.map +1 -1
- package/mobile/lib/api/LikeAPI.js +2 -2
- package/mobile/lib/api/LikeAPI.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTile.js +10 -23
- package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/mobile/lib/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/mobile/lib/components/ProductTile/renderAdditionalDescription.js +15 -0
- package/mobile/lib/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/mobile/lib/components/ProductTile/renderBenefit.d.ts +4 -0
- package/mobile/lib/components/ProductTile/renderBenefit.js +29 -0
- package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -0
- package/mobile/lib/components/ProductTile/renderImage.d.ts +3 -0
- package/mobile/lib/components/ProductTile/renderImage.js +9 -0
- package/mobile/lib/components/ProductTile/renderImage.js.map +1 -0
- package/mobile/lib/content-page-repository/transformImg.d.ts +1 -1
- package/mobile/lib/content-page-repository/transformImg.js +4 -10
- package/mobile/lib/content-page-repository/transformImg.js.map +1 -1
- package/mobile/lib/content-page-repository/transformMarkdown.js +3 -3
- package/mobile/lib/content-page-repository/transformMarkdown.js.map +1 -1
- package/mobile/lib/hooks/useLink.js +3 -5
- package/mobile/lib/hooks/useLink.js.map +1 -1
- package/mobile/lib/hooks/useLocation.js +11 -5
- package/mobile/lib/hooks/useLocation.js.map +1 -1
- package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/mobile/lib/services/sitemap/isHrefActive.js +3 -4
- package/mobile/lib/services/sitemap/isHrefActive.js.map +1 -1
- package/mobile/lib/setup-fixture.js +3 -3
- package/mobile/lib/setup-fixture.js.map +1 -1
- package/mobile/lib/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownText.js +7 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/mobile/lib/ui-kit/Text/Text.js +1 -5
- package/mobile/lib/ui-kit/Text/Text.js.map +1 -1
- package/mobile/lib/utils/normalizeURLPath.d.ts +1 -0
- package/mobile/lib/utils/normalizeURLPath.js +9 -0
- package/mobile/lib/utils/normalizeURLPath.js.map +1 -0
- package/mobile/lib/utils/url.d.ts +1 -0
- package/mobile/lib/utils/url.js +7 -0
- package/mobile/lib/utils/url.js.map +1 -1
- package/mobile/lib/wlc.json +3 -1
- package/mobile/src/ProjectSettings.ts +6 -0
- package/mobile/src/api/LikeAPI.ts +2 -2
- package/mobile/src/common.css +50 -0
- package/mobile/src/components/ProductTile/ProductTile.example.json +3 -0
- package/mobile/src/components/ProductTile/ProductTile.tsx +13 -44
- package/mobile/src/components/ProductTile/ProductTile.ui.json +14 -1
- package/mobile/src/components/ProductTile/ProductTileContent.ts +26 -2
- package/mobile/src/components/ProductTile/renderAdditionalDescription.tsx +30 -0
- package/mobile/src/components/ProductTile/renderBenefit.tsx +39 -0
- package/mobile/src/components/ProductTile/renderImage.tsx +15 -0
- package/mobile/src/content-page-repository/transformImg.ts +6 -14
- package/mobile/src/content-page-repository/transformMarkdown.ts +3 -3
- package/mobile/src/hooks/useLink.ts +6 -7
- package/mobile/src/hooks/useLocation.ts +12 -6
- package/mobile/src/services/BlockRouter/BlockRouter.ts +1 -1
- package/mobile/src/services/sitemap/checkIsHrefSameOrigin.ts +5 -4
- package/mobile/src/services/sitemap/isHrefActive.ts +7 -4
- package/mobile/src/setup-fixture.ts +3 -3
- package/mobile/src/ui-kit/MarkdownText/MarkdownText.tsx +8 -0
- package/mobile/src/ui-kit/MarkdownText/MarkdownTextProps.ts +6 -0
- package/mobile/src/ui-kit/Text/Text.tsx +5 -7
- package/mobile/src/utils/normalizeURLPath.ts +10 -0
- package/mobile/src/utils/url.ts +10 -0
- package/mobile/src/wlc.json +3 -1
- package/package.json +1 -1
- package/src/ProjectSettings.ts +6 -0
- package/src/api/LikeAPI.ts +2 -2
- package/src/common.css +50 -0
- package/src/components/Header/Header.tsx +2 -10
- package/src/components/ProductTile/ProductTile.example.json +3 -0
- package/src/components/ProductTile/ProductTile.fixture.tsx +11 -4
- package/src/components/ProductTile/ProductTile.tsx +13 -44
- package/src/components/ProductTile/ProductTile.ui.json +14 -1
- package/src/components/ProductTile/ProductTileContent.ts +26 -2
- package/src/components/ProductTile/renderAdditionalDescription.tsx +30 -0
- package/src/components/ProductTile/renderBenefit.tsx +39 -0
- package/src/components/ProductTile/renderImage.tsx +15 -0
- package/src/components/TextBlock/TextBlock.tsx +49 -41
- package/src/content-page-repository/transformImg.ts +6 -14
- package/src/content-page-repository/transformMarkdown.ts +3 -3
- package/src/hooks/useLink.ts +6 -7
- package/src/hooks/useLocation.ts +12 -6
- package/src/services/BlockRouter/BlockRouter.ts +1 -1
- package/src/services/sitemap/checkIsHrefSameOrigin.ts +5 -4
- package/src/services/sitemap/isHrefActive.ts +7 -4
- package/src/setup-fixture.ts +3 -3
- package/src/ui-kit/MarkdownText/MarkdownText.tsx +8 -0
- package/src/ui-kit/MarkdownText/MarkdownTextProps.ts +6 -0
- package/src/ui-kit/Text/Text.tsx +5 -7
- package/src/utils/normalizeURLPath.ts +10 -0
- package/src/utils/url.ts +10 -0
- package/src/wlc.json +3 -1
package/mobile/src/utils/url.ts
CHANGED
|
@@ -15,6 +15,16 @@ export const getOrigin = (href?: string) => {
|
|
|
15
15
|
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
export const getPathname = (href?: string) => {
|
|
19
|
+
if (!href || !isURL(href)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const url = new URL(href);
|
|
24
|
+
|
|
25
|
+
return url.pathname;
|
|
26
|
+
};
|
|
27
|
+
|
|
18
28
|
export const getHash = (href?: string) => {
|
|
19
29
|
if (!href || !isURL(href)) {
|
|
20
30
|
return undefined;
|
package/mobile/src/wlc.json
CHANGED
package/package.json
CHANGED
package/src/ProjectSettings.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface ProjectSettings {
|
|
|
7
7
|
SITEMAP?: string;
|
|
8
8
|
FOOTER?: string;
|
|
9
9
|
CDN?: string; // Should ends with "/"
|
|
10
|
+
BASE_PATH?: string; // Should ends with "/"
|
|
10
11
|
YANDEX_MAP_API_KEY?: string;
|
|
11
12
|
YANDEX_METRIKA_ID?: string;
|
|
12
13
|
}
|
|
@@ -45,6 +46,11 @@ export const projectSettings = new (class implements ProjectSettings {
|
|
|
45
46
|
get CDN() {
|
|
46
47
|
return this._.CDN;
|
|
47
48
|
}
|
|
49
|
+
get BASE_PATH() {
|
|
50
|
+
return this._.BASE_PATH && !this._.BASE_PATH.endsWith('/')
|
|
51
|
+
? `${this._.BASE_PATH}/`
|
|
52
|
+
: this._.BASE_PATH;
|
|
53
|
+
}
|
|
48
54
|
get YANDEX_MAP_API_KEY() {
|
|
49
55
|
return this._.YANDEX_MAP_API_KEY;
|
|
50
56
|
}
|
package/src/api/LikeAPI.ts
CHANGED
|
@@ -114,7 +114,7 @@ export function LikeAPI() {
|
|
|
114
114
|
|
|
115
115
|
async function auth(): Promise<UserData> {
|
|
116
116
|
try {
|
|
117
|
-
const userData: UserData = JSON.parse(globalThis.localStorage
|
|
117
|
+
const userData: UserData = JSON.parse(globalThis.localStorage?.getItem(STORAGE_KEY) || '');
|
|
118
118
|
if (userData?.token) {
|
|
119
119
|
return userData;
|
|
120
120
|
}
|
|
@@ -136,7 +136,7 @@ export function LikeAPI() {
|
|
|
136
136
|
|
|
137
137
|
const { token, name } = await response.json();
|
|
138
138
|
|
|
139
|
-
globalThis.localStorage
|
|
139
|
+
globalThis.localStorage?.setItem(STORAGE_KEY, JSON.stringify({ token, name }));
|
|
140
140
|
|
|
141
141
|
return { token, name } as UserData;
|
|
142
142
|
} catch (e) {
|
package/src/common.css
CHANGED
|
@@ -151,6 +151,56 @@ html {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
@layer components {
|
|
155
|
+
.md-container .h1 {
|
|
156
|
+
@apply text-h1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.md-container .h2 {
|
|
160
|
+
@apply text-h2;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.md-container .h3 {
|
|
164
|
+
@apply text-h3;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.md-container .h4 {
|
|
168
|
+
@apply text-h4;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.md-container .h5 {
|
|
172
|
+
@apply text-h5;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.md-container .h6 {
|
|
176
|
+
@apply text-h6;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.md-container ul {
|
|
180
|
+
@apply list-inside list-disc;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.md-container ol {
|
|
184
|
+
@apply list-inside list-decimal;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.md-container p {
|
|
188
|
+
@apply text-l font-light;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.md-container li {
|
|
192
|
+
@apply text-l font-light;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.md-container li > p {
|
|
196
|
+
@apply inline;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.md-container a {
|
|
200
|
+
@apply text-primary-main;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
154
204
|
/*
|
|
155
205
|
Styling Yandex Map element
|
|
156
206
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useRouter } from '../../hooks/useRouter';
|
|
3
3
|
import type { BgColorVersion } from '../../model/BgColorVersion';
|
|
4
4
|
import type { UniBlockProps } from '../../model/JSXBlock';
|
|
5
|
-
import type { TopMenuItem } from '../../model/SitemapProps';
|
|
6
5
|
import { projectSettings } from '../../ProjectSettings';
|
|
7
6
|
import { isTopItemActive } from '../../services/sitemap/isTopItemActive';
|
|
8
7
|
import type { SitemapDataProps } from '../../services/sitemap/SitemapProps';
|
|
@@ -31,7 +30,7 @@ export const Header = JSX<HeaderProps>(
|
|
|
31
30
|
rest.options?.page?.fallback,
|
|
32
31
|
);
|
|
33
32
|
|
|
34
|
-
const activeTopItem =
|
|
33
|
+
const activeTopItem = topItems?.find(isTopItemActive(router));
|
|
35
34
|
|
|
36
35
|
const topMenu = topItems?.map((_, i) => (
|
|
37
36
|
<TopItem
|
|
@@ -72,10 +71,3 @@ export const Header = JSX<HeaderProps>(
|
|
|
72
71
|
);
|
|
73
72
|
},
|
|
74
73
|
);
|
|
75
|
-
|
|
76
|
-
const getActiveItem = (topItems: TopMenuItem[] | undefined, router: Router) => {
|
|
77
|
-
const [firstPortal] = topItems || [];
|
|
78
|
-
|
|
79
|
-
// Если по слагу невозможно понять к какому подпорталу этот слаг относиться, то выбираем первый подпортал.
|
|
80
|
-
return topItems?.find(isTopItemActive(router)) || firstPortal;
|
|
81
|
-
};
|
|
@@ -12,14 +12,17 @@
|
|
|
12
12
|
"version": "primary",
|
|
13
13
|
"benefits": [
|
|
14
14
|
{
|
|
15
|
+
"type": "default",
|
|
15
16
|
"label": "Преимущество 1",
|
|
16
17
|
"description": "Описание"
|
|
17
18
|
},
|
|
18
19
|
{
|
|
20
|
+
"type": "default",
|
|
19
21
|
"label": "Преимущество 2",
|
|
20
22
|
"description": "Описание"
|
|
21
23
|
},
|
|
22
24
|
{
|
|
25
|
+
"type": "default",
|
|
23
26
|
"label": "Преимущество 3",
|
|
24
27
|
"description": "Описание"
|
|
25
28
|
}
|
|
@@ -2,7 +2,7 @@ import type { Picture } from '../../model/Picture';
|
|
|
2
2
|
import '../../setup-fixture';
|
|
3
3
|
import type { ButtonProps } from '../../ui-kit/Button/ButtonProps';
|
|
4
4
|
import { ProductTile } from './ProductTile';
|
|
5
|
-
import type { ProductTileContent } from './ProductTileContent';
|
|
5
|
+
import type { Benefit, ProductTileContent } from './ProductTileContent';
|
|
6
6
|
|
|
7
7
|
const imageSize = {
|
|
8
8
|
height: 242,
|
|
@@ -37,38 +37,45 @@ const building: Picture = {
|
|
|
37
37
|
size: imageSize,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const benefits = [
|
|
40
|
+
const benefits: Benefit[] = [
|
|
41
41
|
{
|
|
42
|
+
type: 'default',
|
|
42
43
|
label: 'до 5 млн Р',
|
|
43
44
|
description: 'Кредитный лимит',
|
|
44
45
|
},
|
|
45
46
|
{
|
|
47
|
+
type: 'default',
|
|
46
48
|
label: 'от 12,5%',
|
|
47
49
|
description: 'Процентная ставка',
|
|
48
50
|
},
|
|
49
51
|
{
|
|
52
|
+
type: 'default',
|
|
50
53
|
label: 'до 5 лет',
|
|
51
54
|
description: 'Срок кредитования',
|
|
52
55
|
},
|
|
53
56
|
];
|
|
54
57
|
|
|
55
|
-
const benefits2 = [
|
|
58
|
+
const benefits2: Benefit[] = [
|
|
56
59
|
{
|
|
60
|
+
type: 'default',
|
|
57
61
|
label: '1 год',
|
|
58
62
|
description: 'срок программы',
|
|
59
63
|
},
|
|
60
64
|
];
|
|
61
65
|
|
|
62
|
-
const multilineBenefits = [
|
|
66
|
+
const multilineBenefits: Benefit[] = [
|
|
63
67
|
{
|
|
68
|
+
type: 'default',
|
|
64
69
|
label: 'Широкий',
|
|
65
70
|
description: 'выбор платёжных систем',
|
|
66
71
|
},
|
|
67
72
|
{
|
|
73
|
+
type: 'default',
|
|
68
74
|
label: 'Специальные',
|
|
69
75
|
description: 'условия по снятию наличных условия по снятию наличных',
|
|
70
76
|
},
|
|
71
77
|
{
|
|
78
|
+
type: 'default',
|
|
72
79
|
label: '0,5 балла',
|
|
73
80
|
description: '«Урожай» за 100 рублей «Урожай» за 100 рублей',
|
|
74
81
|
},
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
|
-
import {
|
|
3
|
+
import { VersionStyleMap } from '../../model/BlockVersion';
|
|
4
4
|
import type { UniBlockProps } from '../../model/JSXBlock';
|
|
5
5
|
import type { Picture } from '../../model/Picture';
|
|
6
6
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
7
7
|
import { ButtonSection } from '../../ui-kit/Button/ButtonSection';
|
|
8
|
-
import { Img } from '../../ui-kit/Img/Img';
|
|
9
8
|
import { getTileRightPadding } from '../BaseTile/getTileRightPadding';
|
|
10
9
|
import { Headline } from '../Headline/Headline';
|
|
11
|
-
import type {
|
|
10
|
+
import type { Benefit, ProductTileContent } from './ProductTileContent';
|
|
11
|
+
import { renderAdditionalDescription } from './renderAdditionalDescription';
|
|
12
|
+
import { renderBenefit } from './renderBenefit';
|
|
13
|
+
import { renderImage } from './renderImage';
|
|
12
14
|
|
|
13
15
|
export interface ProductTileProps extends ProductTileContent, UniBlockProps {}
|
|
14
16
|
|
|
@@ -43,7 +45,7 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
43
45
|
{...rest}
|
|
44
46
|
/>
|
|
45
47
|
{renderBenefits(benefits, version, image)}
|
|
46
|
-
{
|
|
48
|
+
{renderAdditionalDescription(additionalDescription, image)}
|
|
47
49
|
{buttons?.length ? (
|
|
48
50
|
<ButtonSection buttons={buttons} className="mt-5 gap-4 z-10 text-l" />
|
|
49
51
|
) : null}
|
|
@@ -53,53 +55,20 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
53
55
|
),
|
|
54
56
|
);
|
|
55
57
|
|
|
56
|
-
function renderBenefits(benefits:
|
|
58
|
+
function renderBenefits(benefits: Benefit[], version: BlockVersion, image?: Picture) {
|
|
59
|
+
if (!benefits.length) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
// picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
|
|
58
|
-
const
|
|
64
|
+
const benefitsWidth = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
|
|
59
65
|
|
|
60
66
|
return (
|
|
61
67
|
<div
|
|
62
68
|
className={`z-10 grid grid-cols-[max-content_1fr] auto-rows-auto gap-x-6 gap-y-2.5 items-baseline
|
|
63
|
-
${
|
|
69
|
+
${benefitsWidth}`}
|
|
64
70
|
>
|
|
65
71
|
{benefits.length ? benefits.map(renderBenefit(version)) : null}
|
|
66
72
|
</div>
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
|
-
|
|
70
|
-
const renderBenefit =
|
|
71
|
-
(version: BlockVersion = 'primary') =>
|
|
72
|
-
(benefit: TextBenefit, i: number) => {
|
|
73
|
-
const { label = '', description = '' } = benefit;
|
|
74
|
-
|
|
75
|
-
return [
|
|
76
|
-
<div key={`label-${i}`} className="text-h6">
|
|
77
|
-
{label}
|
|
78
|
-
</div>,
|
|
79
|
-
<div key={`desc-${i}`} className={`text-m-light ${VersionAdditionalStyleMap[version]}`}>
|
|
80
|
-
{description}
|
|
81
|
-
</div>,
|
|
82
|
-
];
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
function renderAdditionalDescription(additionalDescription: string, image?: Picture) {
|
|
86
|
-
// picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
|
|
87
|
-
const DESCRIPTION_WIDTH = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className={`text-m-light mt-2.5 z-10 ${DESCRIPTION_WIDTH}`}>{additionalDescription}</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function renderImage(image?: Picture, isImageOnRightSide?: boolean) {
|
|
95
|
-
if (!image?.src) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<Img
|
|
101
|
-
className={`absolute ${isImageOnRightSide ? 'right-0' : 'left-0'} bottom-0`}
|
|
102
|
-
image={image}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
@@ -2,8 +2,32 @@ import type { BlockVersion } from '../../model/BlockVersion';
|
|
|
2
2
|
import type { DescriptionProps, HeadlineProps, LabelProps } from '../../model/HeadlineType';
|
|
3
3
|
import type { Picture } from '../../model/Picture';
|
|
4
4
|
import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
|
|
5
|
+
import type { MarkdownTextProps } from '../../ui-kit/MarkdownText/MarkdownTextProps';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @title Стандартный
|
|
9
|
+
*/
|
|
10
|
+
type TextBenefit = DescriptionProps &
|
|
11
|
+
LabelProps & {
|
|
12
|
+
/** @default default */
|
|
13
|
+
type: 'default';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @title Форматированный текст
|
|
18
|
+
*/
|
|
19
|
+
type MarkdownTextContent = MarkdownTextProps & {
|
|
20
|
+
/** @default md */
|
|
21
|
+
type: 'md';
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @title Преимущество
|
|
26
|
+
* @default{
|
|
27
|
+
* "type": "default"
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
export type Benefit = TextBenefit | MarkdownTextContent;
|
|
7
31
|
|
|
8
32
|
/**
|
|
9
33
|
* @title Продуктовая плитка
|
|
@@ -30,7 +54,7 @@ export type ProductTileContent = HeadlineProps &
|
|
|
30
54
|
* @title Преимущества
|
|
31
55
|
* @maxItems 7
|
|
32
56
|
*/
|
|
33
|
-
benefits?:
|
|
57
|
+
benefits?: Benefit[];
|
|
34
58
|
/** @title Дополнительное описание */
|
|
35
59
|
additionalDescription?: string;
|
|
36
60
|
/** @title Картинка справа/текст слева */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import type { Picture } from '../../model/Picture';
|
|
3
|
+
import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
|
|
4
|
+
import type { TextColor } from '../../ui-kit/Text/TextProps';
|
|
5
|
+
|
|
6
|
+
const DESCRIPTION_STYLE_MAP: Record<BlockVersion, TextColor> = {
|
|
7
|
+
primary: 'text-secondary-text',
|
|
8
|
+
secondary: 'text-white',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function renderAdditionalDescription(
|
|
12
|
+
additionalDescription?: string,
|
|
13
|
+
image?: Picture,
|
|
14
|
+
version: BlockVersion = 'primary',
|
|
15
|
+
) {
|
|
16
|
+
if (!additionalDescription) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
|
|
21
|
+
const descriptionWidth = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={`mt-2.5 z-10 ${descriptionWidth}`}>
|
|
25
|
+
<Paragraph size="text-m" font="font-light" color={DESCRIPTION_STYLE_MAP[version]}>
|
|
26
|
+
{additionalDescription}
|
|
27
|
+
</Paragraph>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import { MarkdownText } from '../../ui-kit/MarkdownText/MarkdownText';
|
|
3
|
+
import { Text } from '../../ui-kit/Text/Text';
|
|
4
|
+
import type { TextColor } from '../../ui-kit/Text/TextProps';
|
|
5
|
+
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
6
|
+
import type { Benefit } from './ProductTileContent';
|
|
7
|
+
|
|
8
|
+
const LABEL_STYLE_MAP: Record<BlockVersion, TextColor> = {
|
|
9
|
+
primary: 'text-secondary-text',
|
|
10
|
+
secondary: 'text-white',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const renderBenefit =
|
|
14
|
+
(version: BlockVersion = 'primary') =>
|
|
15
|
+
// Linter doesn't understand that switch processes all cases
|
|
16
|
+
// eslint-disable-next-line consistent-return
|
|
17
|
+
(benefit: Benefit, i: number) => {
|
|
18
|
+
const { type } = benefit;
|
|
19
|
+
|
|
20
|
+
if (!(type === 'default' || type === 'md')) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 'default':
|
|
26
|
+
return [
|
|
27
|
+
<Text key={`label-${i}`} size="text-h6">
|
|
28
|
+
{benefit.label}
|
|
29
|
+
</Text>,
|
|
30
|
+
<Text key={`desc-${i}`} size="text-m-light" color={LABEL_STYLE_MAP[version]}>
|
|
31
|
+
{benefit.description}
|
|
32
|
+
</Text>,
|
|
33
|
+
];
|
|
34
|
+
case 'md':
|
|
35
|
+
return <MarkdownText md={benefit.md} />;
|
|
36
|
+
default:
|
|
37
|
+
assertUnreachable(benefit);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Picture } from '../../model/Picture';
|
|
2
|
+
import { Img } from '../../ui-kit/Img/Img';
|
|
3
|
+
|
|
4
|
+
export function renderImage(image?: Picture, isImageOnRightSide?: boolean) {
|
|
5
|
+
if (!image?.src) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Img
|
|
11
|
+
className={`absolute ${isImageOnRightSide ? 'right-0' : 'left-0'} bottom-0`}
|
|
12
|
+
image={image}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -3,51 +3,43 @@ import type { UniBlockProps } from '../../model/JSXBlock';
|
|
|
3
3
|
import type { Picture } from '../../model/Picture';
|
|
4
4
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
5
5
|
import { Img } from '../../ui-kit/Img/Img';
|
|
6
|
+
import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
|
|
7
|
+
import { Text } from '../../ui-kit/Text/Text';
|
|
6
8
|
import type { TextBlockContent, TextBlockVersion } from './TextBlockContent';
|
|
7
9
|
|
|
8
10
|
export interface TextBlockProps extends TextBlockContent, UniBlockProps {}
|
|
9
11
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
primary: {
|
|
15
|
-
background: 'bg-white',
|
|
16
|
-
icon: 'bg-primary-main text-white',
|
|
17
|
-
title: 'text-primary-text',
|
|
18
|
-
description: 'text-secondary-text',
|
|
19
|
-
},
|
|
20
|
-
secondary: {
|
|
21
|
-
background: 'bg-primary-main',
|
|
22
|
-
icon: 'bg-white text-primary-main',
|
|
23
|
-
title: 'text-white',
|
|
24
|
-
description: 'text-white',
|
|
25
|
-
},
|
|
26
|
-
'secondary-light': {
|
|
27
|
-
background: 'bg-primary-main/10',
|
|
28
|
-
icon: 'bg-primary-main text-white',
|
|
29
|
-
title: 'text-primary-text',
|
|
30
|
-
description: 'text-secondary-text',
|
|
31
|
-
},
|
|
12
|
+
const textBlockBack: Record<TextBlockVersion, string> = {
|
|
13
|
+
primary: 'bg-white',
|
|
14
|
+
secondary: 'bg-primary-main',
|
|
15
|
+
'secondary-light': 'bg-primary-main/10',
|
|
32
16
|
};
|
|
33
17
|
|
|
34
18
|
export const TextBlock = JSX<TextBlockProps>(
|
|
35
|
-
({
|
|
36
|
-
|
|
19
|
+
({
|
|
20
|
+
className = '',
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
blockVersion = 'primary',
|
|
24
|
+
iconVersion,
|
|
25
|
+
image,
|
|
26
|
+
...rest
|
|
27
|
+
}) => {
|
|
28
|
+
const isSecondaryBlock = blockVersion === 'secondary';
|
|
37
29
|
|
|
38
30
|
return (
|
|
39
31
|
<BlockWrapper
|
|
40
|
-
className={`
|
|
32
|
+
className={`px-9 py-4 flex gap-3 ${textBlockBack[blockVersion]} ${className}`}
|
|
41
33
|
{...rest}
|
|
42
34
|
>
|
|
43
|
-
{iconVersion === 'small' ?
|
|
35
|
+
{iconVersion === 'small' ? (
|
|
36
|
+
<div className="mt-1">{renderIcon(isSecondaryBlock)}</div>
|
|
37
|
+
) : null}
|
|
44
38
|
{iconVersion === 'big' ? renderImage(image) : null}
|
|
45
|
-
<div
|
|
46
|
-
{title ? (
|
|
47
|
-
<div className={`text-l font-medium mb-1 ${textBlockStyleMap.title}`}>{title}</div>
|
|
48
|
-
) : null}
|
|
39
|
+
<div>
|
|
40
|
+
{title ? renderTitle(title, isSecondaryBlock) : null}
|
|
49
41
|
{description ? (
|
|
50
|
-
<div className=
|
|
42
|
+
<div className="mt-1">{renderDescription(description, isSecondaryBlock)}</div>
|
|
51
43
|
) : null}
|
|
52
44
|
</div>
|
|
53
45
|
</BlockWrapper>
|
|
@@ -55,14 +47,30 @@ export const TextBlock = JSX<TextBlockProps>(
|
|
|
55
47
|
},
|
|
56
48
|
);
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
const renderIcon = (isSecondaryBlock: boolean) => (
|
|
51
|
+
<div
|
|
52
|
+
className={`rounded-full h-4 w-4 text-center text-xs-light ${
|
|
53
|
+
isSecondaryBlock ? 'bg-white text-primary-main' : 'bg-primary-main text-white'
|
|
54
|
+
}`}
|
|
55
|
+
>
|
|
56
|
+
i
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const renderImage = (image?: Picture) => (image?.src ? <Img image={image} /> : null);
|
|
61
|
+
|
|
62
|
+
const renderTitle = (title: string, isSecondaryBlock: boolean) => (
|
|
63
|
+
<Text
|
|
64
|
+
size="text-l"
|
|
65
|
+
font="font-medium"
|
|
66
|
+
color={isSecondaryBlock ? 'text-white' : 'text-primary-text'}
|
|
67
|
+
>
|
|
68
|
+
{title}
|
|
69
|
+
</Text>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const renderDescription = (description: string, isSecondaryBlock: boolean) => (
|
|
73
|
+
<Paragraph size="text-s" color={isSecondaryBlock ? 'text-white' : 'text-secondary-text'}>
|
|
74
|
+
{description}
|
|
75
|
+
</Paragraph>
|
|
76
|
+
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import util from 'util';
|
|
4
|
-
import sharp from 'sharp';
|
|
5
3
|
import type { ResizeOptions, Sharp } from 'sharp';
|
|
4
|
+
import sharp from 'sharp';
|
|
5
|
+
import util from 'util';
|
|
6
6
|
import type { ImageSize } from '../model/ImageSize';
|
|
7
|
-
import type { TransformationOptions } from './TransformationOptions';
|
|
8
7
|
import type { ImgAlignment, ImgSource, Picture } from '../model/Picture';
|
|
9
|
-
import { transformSrc } from './transformSrc';
|
|
10
8
|
import { isPictureSizeEmpty } from '../utils/isPictureSizeEmpty';
|
|
9
|
+
import type { TransformationOptions } from './TransformationOptions';
|
|
10
|
+
import { transformSrc } from './transformSrc';
|
|
11
11
|
|
|
12
12
|
const mkdir = util.promisify(fs.mkdir);
|
|
13
13
|
|
|
@@ -126,20 +126,12 @@ function getCompositionResizeSize(
|
|
|
126
126
|
const { width, height } = size;
|
|
127
127
|
const { width: containerWidth, height: containerHeight } = containerSize;
|
|
128
128
|
|
|
129
|
-
let widthRatio = 0;
|
|
130
|
-
let heightRatio = 0;
|
|
131
|
-
|
|
132
129
|
if (!(width || height)) {
|
|
133
130
|
return undefined;
|
|
134
131
|
}
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (height) {
|
|
141
|
-
heightRatio = containerHeight / height;
|
|
142
|
-
}
|
|
133
|
+
const widthRatio = width ? containerWidth / width : 0;
|
|
134
|
+
const heightRatio = height ? containerHeight / height : 0;
|
|
143
135
|
|
|
144
136
|
return widthRatio > heightRatio
|
|
145
137
|
? { width: Math.min(Number(width), containerWidth) }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { unified } from 'unified';
|
|
2
|
-
import remarkParse from 'remark-parse';
|
|
3
1
|
import remarkHtml from 'remark-html';
|
|
2
|
+
import remarkParse from 'remark-parse';
|
|
3
|
+
import { unified } from 'unified';
|
|
4
4
|
|
|
5
5
|
export async function transformMarkdown(markdown: string | null | undefined): Promise<string> {
|
|
6
6
|
if (!markdown) {
|
|
@@ -9,5 +9,5 @@ export async function transformMarkdown(markdown: string | null | undefined): Pr
|
|
|
9
9
|
|
|
10
10
|
const result = await unified().use(remarkParse).use(remarkHtml).process(markdown);
|
|
11
11
|
|
|
12
|
-
return result.toString('utf-8');
|
|
12
|
+
return result.toString('utf-8').replaceAll(/<h(\d)>([^<]*)<\/h\d>/g, '<p class="h$1">$2</p>');
|
|
13
13
|
}
|