From 417b452953751992f816d0ce6fcccd2514b84206 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Mon, 24 Sep 2018 23:44:30 +0800 Subject: [PATCH] Update: Log container --- src/containers/Logs/index.tsx | 67 +++++++++++++++++++++++++++++++++- src/containers/Logs/style.scss | 26 ++++++++++++- src/styles/common.scss | 3 +- 3 files changed, 92 insertions(+), 4 deletions(-) diff --git a/src/containers/Logs/index.tsx b/src/containers/Logs/index.tsx index be9cf49..9a04cda 100644 --- a/src/containers/Logs/index.tsx +++ b/src/containers/Logs/index.tsx @@ -1,13 +1,76 @@ import * as React from 'react' +import * as dayjs from 'dayjs' import { Card, Header } from '@components' import './style.scss' -export default class Logs extends React.Component<{}, {}> { +interface LogsState { + listHeight: number +} + +export default class Logs extends React.Component<{}, LogsState> { + state: LogsState = { + listHeight: 0 + } + + componentDidMount () { + this.setListHeight() + } + + setListHeight = () => { + this.setState({ + listHeight: document.querySelector('.logs-card').clientHeight - 30 + }) + } + render () { + const logs = [ + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() }, + { type: 'info', payload: 'google.com match DomainSuffix using Proxy', timestamp: +new Date() } + ] + + const listHeight = { height: this.state.listHeight } return (