Commit 691e9fdb authored by Carlos's avatar Carlos

slim the package size

parent 34a1a850
...@@ -2,14 +2,40 @@ ...@@ -2,14 +2,40 @@
exports[`PullDownContent spec App shows PullDownContent 1`] = ` exports[`PullDownContent spec App shows PullDownContent 1`] = `
<div <div
className="sc-bwzfXH kHYjaZ" id="container2"
height="200px"
> >
<div <div
className="sc-htpNat GucRt" id="arrow"
/> />
<span> <span>
Pull down to refresh Pull down to refresh
</span> </span>
<style>
#container2 {
background: #CCC;
height: 200px;
text-align: center;
}
#arrow {
margin: 10px auto;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid #666666;
height: 0;
width: 0;
-webkit-animation: fadein 1.5s infinite;
animation: fadein 1.5s infinite;
}
@keyframes fadein {
0%, 100% {
opacity: 0;
}
45%, 55% {
opacity: 1;
}
}
</style>
</div> </div>
`; `;
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
exports[`RefreshContent spec App shows RefreshContent 1`] = ` exports[`RefreshContent spec App shows RefreshContent 1`] = `
<div <div
className="sc-bdVaJa bkDdBU" id="container"
height="200px"
> >
<div <div
className="sk-fading-circle" className="sk-fading-circle"
...@@ -45,5 +44,155 @@ exports[`RefreshContent spec App shows RefreshContent 1`] = ` ...@@ -45,5 +44,155 @@ exports[`RefreshContent spec App shows RefreshContent 1`] = `
className="sk-circle12 sk-circle" className="sk-circle12 sk-circle"
/> />
</div> </div>
<style>
#container {
display: flex;
flex-direction: column;
justify-content: center;
background: #CCC;
height: 200px;
}
.sk-fading-circle {
width: 40px;
height: 40px;
position: relative;
margin: auto;
}
.sk-fading-circle .sk-circle {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.sk-fading-circle .sk-circle:before {
content: '';
display: block;
margin: 0 auto;
width: 15%;
height: 15%;
background-color: #333;
border-radius: 100%;
-webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
}
.sk-fading-circle .sk-circle2 {
-webkit-transform: rotate(30deg);
-ms-transform: rotate(30deg);
transform: rotate(30deg);
}
.sk-fading-circle .sk-circle3 {
-webkit-transform: rotate(60deg);
-ms-transform: rotate(60deg);
transform: rotate(60deg);
}
.sk-fading-circle .sk-circle4 {
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.sk-fading-circle .sk-circle5 {
-webkit-transform: rotate(120deg);
-ms-transform: rotate(120deg);
transform: rotate(120deg);
}
.sk-fading-circle .sk-circle6 {
-webkit-transform: rotate(150deg);
-ms-transform: rotate(150deg);
transform: rotate(150deg);
}
.sk-fading-circle .sk-circle7 {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.sk-fading-circle .sk-circle8 {
-webkit-transform: rotate(210deg);
-ms-transform: rotate(210deg);
transform: rotate(210deg);
}
.sk-fading-circle .sk-circle9 {
-webkit-transform: rotate(240deg);
-ms-transform: rotate(240deg);
transform: rotate(240deg);
}
.sk-fading-circle .sk-circle10 {
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
.sk-fading-circle .sk-circle11 {
-webkit-transform: rotate(300deg);
-ms-transform: rotate(300deg);
transform: rotate(300deg);
}
.sk-fading-circle .sk-circle12 {
-webkit-transform: rotate(330deg);
-ms-transform: rotate(330deg);
transform: rotate(330deg);
}
.sk-fading-circle .sk-circle2:before {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.sk-fading-circle .sk-circle3:before {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
.sk-fading-circle .sk-circle4:before {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.sk-fading-circle .sk-circle5:before {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
.sk-fading-circle .sk-circle6:before {
-webkit-animation-delay: -0.7s;
animation-delay: -0.7s;
}
.sk-fading-circle .sk-circle7:before {
-webkit-animation-delay: -0.6s;
animation-delay: -0.6s;
}
.sk-fading-circle .sk-circle8:before {
-webkit-animation-delay: -0.5s;
animation-delay: -0.5s;
}
.sk-fading-circle .sk-circle9:before {
-webkit-animation-delay: -0.4s;
animation-delay: -0.4s;
}
.sk-fading-circle .sk-circle10:before {
-webkit-animation-delay: -0.3s;
animation-delay: -0.3s;
}
.sk-fading-circle .sk-circle11:before {
-webkit-animation-delay: -0.2s;
animation-delay: -0.2s;
}
.sk-fading-circle .sk-circle12:before {
-webkit-animation-delay: -0.1s;
animation-delay: -0.1s;
}
@-webkit-keyframes sk-circleFadeDelay {
0%, 39%, 100% {
opacity: 0;
}
40% {
opacity: 1;
}
}
@keyframes sk-circleFadeDelay {
0%, 39%, 100% {
opacity: 0;
}
40% {
opacity: 1;
}
}
</style>
</div> </div>
`; `;
...@@ -2,14 +2,41 @@ ...@@ -2,14 +2,41 @@
exports[`ReleaseContent spec App shows ReleaseContent 1`] = ` exports[`ReleaseContent spec App shows ReleaseContent 1`] = `
<div <div
className="sc-bxivhb hxSCts" id="container"
height="200px"
> >
<div <div
className="sc-ifAKCX jLYZjZ" id="arrow"
/> />
<span> <span>
Release to refresh Release to refresh
</span> </span>
<style>
#container {
background: #CCC;
height: 200px;
text-align: center;
}
#arrow {
margin: 10px auto;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 15px solid #666666;
height: 0;
width: 0;
-webkit-animation: fadein 1.5s infinite;
animation: fadein 1.5s infinite;
}
@keyframes fadein {
0%, 100% {
opacity: 0;
}
45%, 55% {
opacity: 1;
}
}
</style>
</div> </div>
`; `;
import * as React from "react"; import * as React from "react";
import styled from "styled-components";
import {PullToRefresh, ReleaseContent, RefreshContent, PullDownContent} from "../src"; import {PullToRefresh, ReleaseContent, RefreshContent, PullDownContent} from "../src";
export interface BasicProps { export interface BasicProps {
...@@ -26,31 +25,31 @@ export class Basic extends React.Component<BasicProps, BasicState> { ...@@ -26,31 +25,31 @@ export class Basic extends React.Component<BasicProps, BasicState> {
onRefresh={this.onRefresh} onRefresh={this.onRefresh}
backgroundColor="white" backgroundColor="white"
> >
<Container> <div id="basic-container">
<Label>PullToRefresh</Label> <div id="basic-label">PullToRefresh</div>
</Container> </div>
<style>{`
#basic-container {
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
background: darkslategray;
}
#basic-label {
user-select: none;
margin-top: 20px;
color: aliceblue;
border: 1px solid aliceblue;
border-radius: 6px;
padding: 5px 2px;
}
#basic-label:hover {
cursor: pointer;
}
`}</style>
</PullToRefresh> </PullToRefresh>
</div> </div>
); );
} }
} }
const Container = styled.div`
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
background: darkslategray;
`;
const Label = styled.div`
user-select: none;
margin-top: 20px;
color: aliceblue;
border: 1px solid aliceblue;
border-radius: 6px;
padding: 5px 2px;
&:hover {
cursor: pointer;
}
`;
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
"react-test-renderer": "^16.5.2", "react-test-renderer": "^16.5.2",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"source-map-loader": "^0.2.3", "source-map-loader": "^0.2.3",
"styled-components": "^3.4.10",
"ts-jest": "^23.10.4", "ts-jest": "^23.10.4",
"tslint": "^5.8.0", "tslint": "^5.8.0",
"tslint-react": "^3.2.0", "tslint-react": "^3.2.0",
...@@ -53,7 +52,6 @@ ...@@ -53,7 +52,6 @@
}, },
"peerDependencies": { "peerDependencies": {
"react": "^16.5.2", "react": "^16.5.2",
"react-dom": "^16.5.2", "react-dom": "^16.5.2"
"styled-components": "^3.4.10"
} }
} }
import * as React from "react"; import * as React from "react";
import styled from "styled-components";
export interface PullDownContentProps { export interface PullDownContentProps {
height?: string; height?: string;
...@@ -7,35 +6,36 @@ export interface PullDownContentProps { ...@@ -7,35 +6,36 @@ export interface PullDownContentProps {
label?: string; label?: string;
} }
export const PullDownContent: React.SFC<PullDownContentProps> = (props) => ( export const PullDownContent: React.SFC<PullDownContentProps> = ({height = "200px", background = "none", label = "Pull down to refresh"}) => (
<Container {...props}> <div id="container2">
<Arrow /> <div id="arrow" />
<span>{props.label || "Pull down to refresh"}</span> <span>{label}</span>
</Container> <style>
{`
#container2 {
background: ${background};
height: ${height};
text-align: center;
}
#arrow {
margin: 10px auto;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid #666666;
height: 0;
width: 0;
-webkit-animation: fadein 1.5s infinite;
animation: fadein 1.5s infinite;
}
@keyframes fadein {
0%, 100% {
opacity: 0;
}
45%, 55% {
opacity: 1;
}
}
`}
</style>
</div>
); );
const Container = styled.div`
background: ${(props: PullDownContentProps) => props.background || "none"};
height: ${(props: PullDownContentProps) => props.height || "200px"};
text-align: center;
`;
const Arrow = styled.div`
margin: 10px auto;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid #666666;
height: 0;
width: 0;
-webkit-animation: fadein 1.5s infinite;
animation: fadein 1.5s infinite;
@keyframes fadein {
0%, 100% {
opacity: 0;
}
45%, 55% {
opacity: 1;
}
}
`;
This diff is collapsed.
import * as React from "react"; import * as React from "react";
import styled from "styled-components";
export interface ReleaseContentProps { export interface ReleaseContentProps {
height?: string; height?: string;
...@@ -7,35 +6,35 @@ export interface ReleaseContentProps { ...@@ -7,35 +6,35 @@ export interface ReleaseContentProps {
label?: string; label?: string;
} }
export const ReleaseContent: React.SFC<ReleaseContentProps> = (props) => ( export const ReleaseContent: React.SFC<ReleaseContentProps> = ({height = "200px", background = "none", label = "Release to refresh"}) => (
<Container {...props}> <div id="container">
<Arrow /> <div id="arrow"/>
<span>{props.label || "Release to refresh"}</span> <span>{label}</span>
</Container> <style>{`
); #container {
background: ${background || "none"};
const Container = styled.div` height: ${height || "200px"};
background: ${(props: ReleaseContentProps) => props.background || "none"}; text-align: center;
height: ${(props: ReleaseContentProps) => props.height || "200px"}; }
text-align: center; #arrow {
`; margin: 10px auto;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 15px solid #666666;
height: 0;
width: 0;
const Arrow = styled.div` -webkit-animation: fadein 1.5s infinite;
margin: 10px auto; animation: fadein 1.5s infinite;
border-left: 15px solid transparent; }
border-right: 15px solid transparent; @keyframes fadein {
border-bottom: 15px solid #666666; 0%, 100% {
height: 0; opacity: 0;
width: 0; }
45%, 55% {
-webkit-animation: fadein 1.5s infinite; opacity: 1;
animation: fadein 1.5s infinite; }
@keyframes fadein { }
0%, 100% { `}</style>
opacity: 0; </div>
} );
45%, 55% {
opacity: 1;
}
}
`;
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
"no-var-requires": true, "no-var-requires": true,
"no-unused-expression": false, "no-unused-expression": false,
"no-duplicate-imports": false, "no-duplicate-imports": false,
"no-trailing-whitespace": false,
"jsx-no-multiline-js": false,
"jsx-boolean-value": false,
"no-object-literal-type-assertion": false, "no-object-literal-type-assertion": false,
"no-string-literal": false, "no-string-literal": false,
"object-literal-sort-keys": false, "object-literal-sort-keys": false,
...@@ -18,4 +21,4 @@ ...@@ -18,4 +21,4 @@
"ordered-imports": false, "ordered-imports": false,
"member-ordering": false "member-ordering": false
} }
} }
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment