Files
bodyshop/client/src/landing/index.jsx
Dave Richer e83badb454 - the great reformat
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-02-06 18:20:58 -05:00

68 lines
1.6 KiB
JavaScript

/* eslint no-undef: 0 */
/* eslint arrow-parens: 0 */
import {enquireScreen} from "enquire-js";
import React from "react";
import Banner0 from "./Banner0";
import {Banner00DataSource, Footer10DataSource,} from "./data.source";
import Footer1 from "./Footer1";
import "./less/antMotionStyle.less";
let isMobile;
enquireScreen((b) => {
isMobile = b;
});
const {location = {}} = typeof window !== "undefined" ? window : {};
export default class Home extends React.Component {
constructor(props) {
super(props);
this.state = {
isMobile,
show: !location.port,
};
}
componentDidMount() {
enquireScreen((b) => {
this.setState({isMobile: !!b});
});
if (location.port) {
// 样式 build 时间在 200-300ms 之间;
setTimeout(() => {
this.setState({
show: true,
});
}, 500);
}
}
render() {
const children = [
<Banner0
id="Banner0_0"
key="Banner0_0"
dataSource={Banner00DataSource}
isMobile={this.state.isMobile}
/>,
<Footer1
id="Footer1_0"
key="Footer1_0"
dataSource={Footer10DataSource}
isMobile={this.state.isMobile}
/>,
];
return (
<div
className="templates-wrapper"
ref={(d) => {
this.dom = d;
}}
>
{this.state.show && children}
</div>
);
}
}