2017-07-18 04:46:32 +00:00
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
import * as React from "react";
|
|
|
|
import styled from "styled-components";
|
|
|
|
import { pulsate } from "shared/styles/animations";
|
|
|
|
import { randomInteger } from "shared/random";
|
2020-07-10 05:33:07 +00:00
|
|
|
import Flex from "components/Flex";
|
2017-07-18 04:46:32 +00:00
|
|
|
|
2019-08-09 06:09:09 +00:00
|
|
|
type Props = {
|
|
|
|
header?: boolean,
|
|
|
|
height?: number,
|
|
|
|
};
|
|
|
|
|
|
|
|
class Mask extends React.Component<Props> {
|
2017-07-18 04:46:32 +00:00
|
|
|
width: number;
|
|
|
|
|
|
|
|
shouldComponentUpdate() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-15 22:49:32 +00:00
|
|
|
componentWillMount() {
|
2017-07-18 04:46:32 +00:00
|
|
|
this.width = randomInteger(75, 100);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return <Redacted width={this.width} {...this.props} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const Redacted = styled(Flex)`
|
|
|
|
width: ${props => (props.header ? props.width / 2 : props.width)}%;
|
2019-01-05 21:37:33 +00:00
|
|
|
height: ${props => (props.height ? props.height : props.header ? 24 : 18)}px;
|
|
|
|
margin-bottom: 6px;
|
2019-03-13 04:35:35 +00:00
|
|
|
background-color: ${props => props.theme.divider};
|
2017-07-18 04:46:32 +00:00
|
|
|
animation: ${pulsate} 1.3s infinite;
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default Mask;
|