Skip to content

Commit

Permalink
add up
Browse files Browse the repository at this point in the history
  • Loading branch information
syntou committed Jan 23, 2020
1 parent b82acd4 commit 5b76f57
Show file tree
Hide file tree
Showing 87 changed files with 1,144 additions and 3 deletions.
8 changes: 8 additions & 0 deletions scripts/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import registerServiceWorker from './registerServiceWorker';
import App from "./views/App";

ReactDOM.render(<App />, document.getElementById('root'));

registerServiceWorker();
4 changes: 4 additions & 0 deletions scripts/src/isDev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* @const whether the environment is development
*/
export default !!(process && process.env.NODE_ENV === 'development');
123 changes: 123 additions & 0 deletions scripts/src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// tslint:disable:no-console
// In production, we register a service worker to serve assets from local cache.

// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on the 'N+1' visit to a page, since previously
// cached resources are updated in the background.

// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior.

const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);

export default function register() {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
process.env.PUBLIC_URL!,
window.location.toString()
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374
return;
}

window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;

if (isLocalhost) {
// This is running on localhost. Lets check if a service worker still exists or not.
checkValidServiceWorker(swUrl);

// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://goo.gl/SC7cgQ'
);
});
} else {
// Is not local host. Just register service worker
registerValidSW(swUrl);
}
});
}
}

function registerValidSW(swUrl: string) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker) {
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the old content will have been purged and
// the fresh content will have been added to the cache.
// It's the perfect time to display a 'New content is
// available; please refresh.' message in your web app.
console.log('New content is available; please refresh.');
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// 'Content is cached for offline use.' message.
console.log('Content is cached for offline use.');
}
}
};
}
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}

function checkValidServiceWorker(swUrl: string) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
if (
response.status === 404 ||
response.headers.get('content-type')!.indexOf('javascript') === -1
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}

export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
12 changes: 12 additions & 0 deletions scripts/src/style/color.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @see https://ant.design/docs/react/customize-theme-cn#Ant-Design-%E7%9A%84%E6%A0%B7%E5%BC%8F%E5%8F%98%E9%87%8F
*/
$color-primary:#1890ff;
$color-text:#303030;
$color-text-darker:#101010;
$color-disable:#909090;
$color-background:#f2efe9;
$color-background-lighter:#e9f1f2;
$color-text-light:#fff;
$color-divide:#d9d9d9;
$color-danger:#f5222d;
4 changes: 4 additions & 0 deletions scripts/src/style/font-size.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$font-size-xs:12px;
$font-size-sm:$font-size-xs+2;
$font-size-md:$font-size-sm+2;
$font-size-lg:$font-size-md+2;
25 changes: 25 additions & 0 deletions scripts/src/style/media.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$width-breakpoint:1440px;
$height-breakpoint:800px;
@mixin width-lg {
@media screen and (min-width: $width-breakpoint) {
@content
}
}

@mixin width-sm {
@media screen and (max-width: $width-breakpoint - 1px) {
@content
}
}

@mixin height-lg {
@media screen and (min-height: $height-breakpoint) {
@content
}
}

@mixin height-sm {
@media screen and (max-height: $height-breakpoint - 1px) {
@content
}
}
12 changes: 12 additions & 0 deletions scripts/src/views/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import Header from './Header';
import Body from "./Body";
import "./base.scss";


export default function App() {
return <div >
<Header />
<Body />
</div>;
}
5 changes: 5 additions & 0 deletions scripts/src/views/Body/DianShiJu/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from "react";

export default function DianShiJu(){
return <div>123456789</div>
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions scripts/src/views/Body/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from "react";
import * as style from "./style.scss";
import DianShiJu from "./DianShiJu";

export default function Body(){
return <div className={style.a}>
123
<DianShiJu />
</div>
}
9 changes: 9 additions & 0 deletions scripts/src/views/Body/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.a{
background-color:#66CCCC;
width:1200px;
height: 5000px;
display: flex;
justify-content: center;
flex-direction: column;
margin: 0 auto;
}
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions scripts/src/views/Header/Top/Center/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react';
import { Input } from 'antd';
import * as style from "./style.scss";

const { Search } = Input;
export default function Center() {
return <div className={style.b}>
<Search className={style.a} placeholder="input search text" onSearch={value => console.log(value)} enterButton={true} />
</div>
}
6 changes: 6 additions & 0 deletions scripts/src/views/Header/Top/Center/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.a{
width: 500px;
}
.b{
margin:0 auto;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions scripts/src/views/Header/Top/Left/BaiNian/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";
import * as style from "./style.scss";

export default function BaiNian() {
return (
<div className={style.box}>
<div className={style.minBox}>
<a href="#" className={style.moveCentext}>拜年祭</a>
<a href="#" className={style.moveCentext}><img src="img-1.png" className={style.move}/></a>
<a href="#" className={style.moveCentext}>拜年祭</a>
</div>
</div>
)
}
28 changes: 28 additions & 0 deletions scripts/src/views/Header/Top/Left/BaiNian/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.box{
overflow: hidden;
height:14px;
}
.min-box{
display: flex;
flex-direction: column;
justify-content: center;
height:300%;
animation:fontMove-1 2s infinite;
animation-direction:alternate;
-webkit-animation-delay:5s;
}
.moveCentext{
width: 42px;
height: 14px;
color:rgb(116,113,113);
text-decoration: none;
font-size: small;
}
.move{
width:42px;
height: 14px;
}
@keyframes fontMove-1 {
  from {transform: translateY(0px);}
  to {transform: translateY(-15px);}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import * as style from './style.scss';
import { Icon } from 'antd';

export default function CartoonItem(props: any) {
return (
<div className={style.item}>
<Icon type="area-chart" className={style.icon}/>
<span>{props.tag}</span>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.icon{
margin-top: 80px;
width: 100px;
height: 200px;
font-size: 24px;
}
.item {
width: 200px;
height: 200px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
cursor: pointer;
background-color: $color-text-light;
transition: 0.3s;
&:hover {
background-color: $color-background-lighter;
}
}
12 changes: 12 additions & 0 deletions scripts/src/views/Header/Top/Left/Cartoon/CartoonContent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import * as style from './style.scss';
import CartoonItem from './CartoonItem';

export default function CartoonContent () {
return (
<div className={style.a}>
<CartoonItem tag="漫画一" />
<CartoonItem tag="漫画二" />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.a{
display: flex;
height: 200px;
width: 200px;
}
12 changes: 12 additions & 0 deletions scripts/src/views/Header/Top/Left/Cartoon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { Popover} from 'antd';
import * as style from './style.scss';
import CartoonContent from './CartoonContent';

export default function Cartoon() {
return (
<Popover title={null} content={<CartoonContent />} placement="bottomLeft">
<a className={style.b}>漫画</a>
</Popover>
);
}
6 changes: 6 additions & 0 deletions scripts/src/views/Header/Top/Left/Cartoon/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.b{
color:rgb(116,113,113);
// margin-left:15px;
text-decoration: none;
font-size: small;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import * as style from './style.scss';
import { Icon } from 'antd';

export default function GameItem(props: any) {
return (
<div className={style.item}>
<Icon type="area-chart" className={style.icon}/>
<span>{props.tag}</span>
</div>
);
}
Loading

0 comments on commit 5b76f57

Please sign in to comment.