@chainplatform/layout 0.1.5 → 0.1.7
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/README.md +12 -12
- package/package.json +1 -1
- package/src/Landing.js +10 -11
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#
|
|
2
|
-
@chainplatform/
|
|
1
|
+
# Chain Platform Layout
|
|
2
|
+
@chainplatform/layout is a React Native library implement for react-native and react-native-web.
|
|
3
3
|
|
|
4
4
|
<p align="center">
|
|
5
|
-
<a href="https://github.com/ChainPlatform/
|
|
5
|
+
<a href="https://github.com/ChainPlatform/react-native-layout/blob/HEAD/LICENSE">
|
|
6
6
|
<img src="https://img.shields.io/badge/license-MIT-blue.svg" />
|
|
7
7
|
</a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@chainplatform/
|
|
9
|
-
<img src="https://img.shields.io/npm/v/@chainplatform/
|
|
8
|
+
<a href="https://www.npmjs.com/package/@chainplatform/layout">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/@chainplatform/layout?color=brightgreen&label=npm%20package" alt="Current npm package version." />
|
|
10
10
|
</a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@chainplatform/
|
|
12
|
-
<img src="https://img.shields.io/npm/dt/@chainplatform/
|
|
11
|
+
<a href="https://www.npmjs.com/package/@chainplatform/layout">
|
|
12
|
+
<img src="https://img.shields.io/npm/dt/@chainplatform/layout.svg"></img>
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://www.npmjs.com/package/@chainplatform/
|
|
14
|
+
<a href="https://www.npmjs.com/package/@chainplatform/layout">
|
|
15
15
|
<img src="https://img.shields.io/badge/platform-android%20%7C%20ios%20%7C%20web-blue"></img>
|
|
16
16
|
</a>
|
|
17
|
-
<a href="https://github.com/ChainPlatform/
|
|
17
|
+
<a href="https://github.com/ChainPlatform/react-native-layout/pulls">
|
|
18
18
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
|
19
19
|
</a>
|
|
20
20
|
<a href="https://twitter.com/intent/follow?screen_name=doansan">
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
|
|
25
25
|
### Install
|
|
26
26
|
```
|
|
27
|
-
npm install @chainplatform/
|
|
27
|
+
npm install @chainplatform/layout --save
|
|
28
28
|
```
|
|
29
29
|
or
|
|
30
30
|
```
|
|
31
|
-
yarn add @chainplatform/
|
|
31
|
+
yarn add @chainplatform/layout
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ yarn add @chainplatform/sdk
|
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
import React from 'react';
|
|
39
|
-
import
|
|
39
|
+
import { getScreenLanding } from '@chainplatform/layout';
|
|
40
40
|
|
|
41
41
|
class App extends React.Component {
|
|
42
42
|
|
package/package.json
CHANGED
package/src/Landing.js
CHANGED
|
@@ -98,22 +98,20 @@ export function getScreenLanding(layoutWidth, isDesktop) {
|
|
|
98
98
|
const newsWidth = newsViewWidth / newsTotalItem;
|
|
99
99
|
//
|
|
100
100
|
let numberChart = 1;
|
|
101
|
-
|
|
102
|
-
if (layoutWidth > 460 && layoutWidth < sdkStyles.base_desktop) {
|
|
101
|
+
if (layoutWidth > 460 && layoutWidth <= sdkStyles.base_desktop) {
|
|
103
102
|
numberChart = 2;
|
|
104
|
-
padding = setSize(45);
|
|
105
103
|
}
|
|
106
|
-
if (layoutWidth
|
|
104
|
+
if (layoutWidth > sdkStyles.base_desktop && layoutWidth <= sdkStyles.split_desktop) {
|
|
107
105
|
numberChart = 3;
|
|
108
|
-
padding = setSize(60);
|
|
109
106
|
}
|
|
110
|
-
if (layoutWidth
|
|
111
|
-
numberChart =
|
|
112
|
-
padding = setSize(90);
|
|
107
|
+
if (layoutWidth > sdkStyles.split_desktop) {
|
|
108
|
+
numberChart = 4;
|
|
113
109
|
}
|
|
110
|
+
const padding = (numberChart + 1) * setSize(15);
|
|
111
|
+
|
|
114
112
|
let packageWidth = (layoutWidth - padding - sideBarWidth) / numberChart;
|
|
115
|
-
if (packageWidth < setSize(
|
|
116
|
-
packageWidth = setSize(
|
|
113
|
+
if (packageWidth < setSize(250)) {
|
|
114
|
+
packageWidth = setSize(250);
|
|
117
115
|
}
|
|
118
116
|
if (packageWidth > setSize(280)) {
|
|
119
117
|
packageWidth = setSize(280);
|
|
@@ -125,7 +123,7 @@ export function getScreenLanding(layoutWidth, isDesktop) {
|
|
|
125
123
|
numberwebinarChart = 2;
|
|
126
124
|
webinarPadding = setSize(15);
|
|
127
125
|
}
|
|
128
|
-
if (layoutWidth >= sdkStyles.split_desktop
|
|
126
|
+
if (layoutWidth >= sdkStyles.split_desktop) {
|
|
129
127
|
numberwebinarChart = 3;
|
|
130
128
|
webinarPadding = setSize(15);
|
|
131
129
|
}
|
|
@@ -164,6 +162,7 @@ export function getScreenLanding(layoutWidth, isDesktop) {
|
|
|
164
162
|
view.newsWidth = newsWidth;
|
|
165
163
|
view.splitPadding = splitPadding;
|
|
166
164
|
view.packageWidth = packageWidth;
|
|
165
|
+
view.packagePadding = padding;
|
|
167
166
|
view.drawerType = drawerType;
|
|
168
167
|
return view;
|
|
169
168
|
}
|