@chainplatform/layout 0.3.2 → 0.3.4

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/index.js CHANGED
@@ -15,6 +15,7 @@ import sdkStyles, { setSize } from "./src/styles";
15
15
  import sdkColors from "./src/colors";
16
16
  import mobileCheck from "./src/DeviceDetect";
17
17
  import { getDoExamLayout } from "./src/Exam";
18
+ import { getDefaultLayout } from "./src/DefaultLayout";
18
19
 
19
20
  export default sdkStyles;
20
21
  export {
@@ -31,6 +32,7 @@ export {
31
32
  getScreenWebinarSize,
32
33
  getScreenLanding,
33
34
  getDoExamLayout,
35
+ getDefaultLayout,
34
36
  sdkColors,
35
37
  setSize,
36
38
  mobileCheck
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainplatform/layout",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "@chainplatform/layout",
5
5
  "main": "index.js",
6
6
  "devDependencies": {
@@ -0,0 +1,23 @@
1
+ import sdkStyles, { setSize } from "./styles";
2
+
3
+ export function getDefaultLayout(layoutWidth, isDesktop) {
4
+ const basePadding = setSize(15);
5
+ let baseItem = 1;
6
+ if (layoutWidth > sdkStyles.base_mobile) {
7
+ baseItem = 2;
8
+ }
9
+ if (layoutWidth > sdkStyles.base_desktop) {
10
+ baseItem = 3;
11
+ }
12
+ if (layoutWidth > sdkStyles.split_desktop) {
13
+ baseItem = 4;
14
+ }
15
+ const baseWidth = layoutWidth - (2 * (baseItem + 1) * basePadding);
16
+ const viewWidth = baseWidth / baseItem;
17
+ let view = {};
18
+ view.basePadding = basePadding;
19
+ view.baseItem = baseItem;
20
+ view.baseWidth = viewWidth;
21
+ view.layout = layoutWidth;
22
+ return view;
23
+ }
package/src/styles.js CHANGED
@@ -15,6 +15,7 @@ const sdkStyles = {
15
15
  DESKTOP: DESKTOP,
16
16
  REM: REM,
17
17
  barHeight: barHeight,
18
+ topBarHeight: mobileCheck.os == "mini_app" ? { height: 41 * REM } : { height: barHeight },
18
19
  headerHeight: mobileCheck.os == "mini_app" ? { height: 39 * REM } : { height: barHeight },
19
20
  headerRightContainerStyle: mobileCheck.os == "mini_app" ? { paddingRight: 80 * REM } : {},
20
21
  image_course_width: 356,
@@ -97,6 +98,7 @@ const sdkStyles = {
97
98
  borderColor: '#DADADA80'
98
99
  },
99
100
  auto: 'auto',
101
+ base_mobile: 375,
100
102
  base_desktop: 767,
101
103
  split_desktop: 991,
102
104
  wide_split_desktop: 1439,