@pushwoosh/dumb-components 2.8.0 → 2.8.1
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/PushStoriesPreview/components/PushStoriesPage/styles.js +4 -3
- package/PushStoriesPreview/components/PushStoriesProgress/styles.js +4 -2
- package/PushStoriesPreview/constants.d.ts +1 -1
- package/PushStoriesPreview/constants.js +2 -1
- package/PushStoriesPreview/helpers.d.ts +2 -0
- package/PushStoriesPreview/helpers.js +5 -1
- package/PushStoriesPreview/styles.js +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
2
3
|
import { PLACEHOLDER_BACKGROUND } from '../../constants';
|
|
3
|
-
import { scaled } from '../../helpers';
|
|
4
|
+
import { placeholderOutline, scaled } from '../../helpers';
|
|
4
5
|
export const PageImage = styled.img.withConfig({
|
|
5
6
|
displayName: "PageImage",
|
|
6
7
|
componentId: "sc-1q2ujdq-0"
|
|
@@ -8,11 +9,11 @@ export const PageImage = styled.img.withConfig({
|
|
|
8
9
|
export const ImagePlaceholder = styled.div.withConfig({
|
|
9
10
|
displayName: "ImagePlaceholder",
|
|
10
11
|
componentId: "sc-1q2ujdq-1"
|
|
11
|
-
})(["position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:", ";color:
|
|
12
|
+
})(["position:absolute;inset:0;display:flex;align-items:center;justify-content:center;", " background:", ";color:", ";> div{transform:scale(1.5);}"], placeholderOutline, PLACEHOLDER_BACKGROUND, Color.PHANTOM);
|
|
12
13
|
export const BottomArea = styled.div.withConfig({
|
|
13
14
|
displayName: "BottomArea",
|
|
14
15
|
componentId: "sc-1q2ujdq-2"
|
|
15
|
-
})(["position:absolute;left:0;right:0;bottom:0;z-index:2;display:flex;flex-direction:column;padding:", " ", " ", ";background:linear-gradient(to bottom,rgba(0,0,0,0) 0%,rgba(0,0,0,0.75) 100%);pointer-events:none;"], scaled(44), scaled(24), scaled(24));
|
|
16
|
+
})(["position:absolute;left:0;right:0;bottom:0;z-index:2;display:flex;flex-direction:column;padding:", " ", " ", ";background:linear-gradient(to bottom,rgba(0,0,0,0) 0%,rgba(0,0,0,0.75) 100%);pointer-events:none;", " ~ &:empty{background:none;}"], scaled(44), scaled(24), scaled(24), ImagePlaceholder);
|
|
16
17
|
export const PageTitle = styled.div.withConfig({
|
|
17
18
|
displayName: "PageTitle",
|
|
18
19
|
componentId: "sc-1q2ujdq-3"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import styled, { css, keyframes } from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
2
3
|
import { scaled } from '../../helpers';
|
|
4
|
+
import { ImagePlaceholder } from '../PushStoriesPage/styles';
|
|
3
5
|
const grow = keyframes(["from{width:0;}to{width:100%;}"]);
|
|
4
6
|
export const ProgressRow = styled.div.withConfig({
|
|
5
7
|
displayName: "ProgressRow",
|
|
@@ -8,10 +10,10 @@ export const ProgressRow = styled.div.withConfig({
|
|
|
8
10
|
export const ProgressTrack = styled.div.withConfig({
|
|
9
11
|
displayName: "ProgressTrack",
|
|
10
12
|
componentId: "sc-1p5nb36-1"
|
|
11
|
-
})(["flex:1;height:max(2px,", ");border-radius:", ";background:rgba(255,255,255,0.3);overflow:hidden;"], scaled(3), scaled(1.5));
|
|
13
|
+
})(["flex:1;height:max(2px,", ");border-radius:", ";background:rgba(255,255,255,0.3);overflow:hidden;", " ~ ", " &{background:", ";}"], scaled(3), scaled(1.5), ImagePlaceholder, ProgressRow, Color.FORM);
|
|
12
14
|
export const ProgressFill = styled.div.withConfig({
|
|
13
15
|
displayName: "ProgressFill",
|
|
14
16
|
componentId: "sc-1p5nb36-2"
|
|
15
|
-
})(["width:100%;height:100%;background:#FFF;", ""], ({
|
|
17
|
+
})(["width:100%;height:100%;background:#FFF;", " ~ ", " &{background:", ";}", ""], ImagePlaceholder, ProgressRow, Color.LOCKED, ({
|
|
16
18
|
$duration
|
|
17
19
|
}) => $duration !== undefined && css(["animation:", " ", "s linear both;"], grow, $duration));
|
|
@@ -5,4 +5,4 @@ export declare const PUSH_STORIES_DEFAULT_DURATION = 5;
|
|
|
5
5
|
/** Longest page duration in seconds the iOS SDK honours. */
|
|
6
6
|
export declare const PUSH_STORIES_MAX_DURATION = 30;
|
|
7
7
|
export declare const REFERENCE_WIDTH = 375;
|
|
8
|
-
export declare const PLACEHOLDER_BACKGROUND = "linear-gradient(160deg, #
|
|
8
|
+
export declare const PLACEHOLDER_BACKGROUND = "linear-gradient(160deg, var(--pw-color-divider, #EBF0F5) 0%, var(--pw-color-frozen, #F7F9FA) 100%)";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
1
2
|
/** Height ÷ width of the stories area, the iOS SDK's default `storyAspectRatio`. */
|
|
2
3
|
export const PUSH_STORIES_ASPECT_RATIO = 1.5;
|
|
3
4
|
/** Seconds a page stays on screen when its duration is missing or invalid. */
|
|
@@ -5,4 +6,4 @@ export const PUSH_STORIES_DEFAULT_DURATION = 5;
|
|
|
5
6
|
/** Longest page duration in seconds the iOS SDK honours. */
|
|
6
7
|
export const PUSH_STORIES_MAX_DURATION = 30;
|
|
7
8
|
export const REFERENCE_WIDTH = 375;
|
|
8
|
-
export const PLACEHOLDER_BACKGROUND =
|
|
9
|
+
export const PLACEHOLDER_BACKGROUND = `linear-gradient(160deg, ${Color.DIVIDER} 0%, ${Color.FROZEN} 100%)`;
|
|
@@ -5,3 +5,5 @@ export declare function normalizeStoryDuration(duration?: number): number;
|
|
|
5
5
|
export declare function hasStoryButton(page: PushStoriesPreviewPage): boolean;
|
|
6
6
|
export declare function clampStoryIndex(index: number, length: number): number;
|
|
7
7
|
export declare function scaled(points: number): string;
|
|
8
|
+
/** Hairline outline that keeps a light placeholder visible on a white card. */
|
|
9
|
+
export declare const placeholderOutline: import("styled-components").FlattenSimpleInterpolation;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
1
3
|
import { PUSH_STORIES_DEFAULT_DURATION, PUSH_STORIES_MAX_DURATION, REFERENCE_WIDTH } from './constants';
|
|
2
4
|
const URL_SCHEME = /^[a-z][a-z\d+.-]*:/i;
|
|
3
5
|
/** Page duration in seconds as the iOS SDK plays it. */
|
|
@@ -16,4 +18,6 @@ export function clampStoryIndex(index, length) {
|
|
|
16
18
|
}
|
|
17
19
|
export function scaled(points) {
|
|
18
20
|
return `calc(${points} * 100cqw / ${REFERENCE_WIDTH})`;
|
|
19
|
-
}
|
|
21
|
+
}
|
|
22
|
+
/** Hairline outline that keeps a light placeholder visible on a white card. */
|
|
23
|
+
export const placeholderOutline = css(["border-radius:inherit;box-shadow:inset 0 0 0 1px ", ";"], Color.DIVIDER);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { FontFamily } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { Color, FontFamily } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { toCssValue } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { PLACEHOLDER_BACKGROUND, PUSH_STORIES_ASPECT_RATIO } from './constants';
|
|
5
|
-
import { scaled } from './helpers';
|
|
5
|
+
import { placeholderOutline, scaled } from './helpers';
|
|
6
6
|
export const StoriesFrame = styled.div.withConfig({
|
|
7
7
|
displayName: "StoriesFrame",
|
|
8
8
|
componentId: "sc-udrlhm-0"
|
|
@@ -20,4 +20,4 @@ export const TapZone = styled.button.withConfig({
|
|
|
20
20
|
export const EmptyState = styled.div.withConfig({
|
|
21
21
|
displayName: "EmptyState",
|
|
22
22
|
componentId: "sc-udrlhm-3"
|
|
23
|
-
})(["position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:", ";padding:0 ", ";background:", ";color:
|
|
23
|
+
})(["position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:", ";padding:0 ", ";", " background:", ";color:", ";font-size:", ";line-height:1.35;text-align:center;> div{margin:", " 0;transform:scale(1.5);}"], scaled(12), scaled(32), placeholderOutline, PLACEHOLDER_BACKGROUND, Color.LOCKED, scaled(15), scaled(6));
|