This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/components/Mask.js

37 lines
848 B
JavaScript
Raw Normal View History

// @flow
2018-05-05 23:16:08 +00:00
import * as React from 'react';
import styled from 'styled-components';
2017-10-27 05:42:08 +00:00
import { pulsate } from 'shared/styles/animations';
import { randomInteger } from 'shared/random';
import Flex from 'shared/components/Flex';
2018-05-05 23:16:08 +00:00
class Mask extends React.Component<*> {
width: number;
shouldComponentUpdate() {
return false;
}
componentWillMount() {
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)}%;
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};
animation: ${pulsate} 1.3s infinite;
&:last-child {
margin-bottom: 0;
}
`;
export default Mask;