/*
Copyright (C) 2017 Cloudbase Solutions SRL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
import React from "react";
import { observer } from "mobx-react";
import styled from "styled-components";
import { Link } from "react-router";
import StatusImage from "@src/components/ui/StatusComponents/StatusImage";
import { ThemePalette, ThemeProps } from "@src/components/Theme";
const Wrapper = styled.div`
background: ${ThemePalette.grayscale[0]};
display: flex;
overflow: auto;
border-radius: ${ThemeProps.borderRadius};
`;
const CountBlock = styled.div`
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
margin: 32px 0;
padding: 0 16px;
border-left: 1px solid white;
height: 96px;
justify-content: center;
&:first-child {
border-left: 1px solid ${ThemePalette.grayscale[0]};
}
@media (max-width: 832px) {
align-items: flex-start;
}
`;
const LoadingWrapper = styled.div`
overflow: hidden;
margin-bottom: 16px;
`;
const CountBlockValue = styled(Link)`
font-size: 53px;
font-weight: ${ThemeProps.fontWeights.extraLight};
text-decoration: none;
color: inherit;
`;
const CountBlockLabel = styled(Link)`
font-size: 12px;
font-weight: ${ThemeProps.fontWeights.medium};
text-transform: uppercase;
color: ${props => props.color};
text-decoration: none;
`;
type Props = {
data: {
label: string;
value: number;
color: string;
link: string;
loading: boolean;
}[];
};
@observer
class DashboardInfoCount extends React.Component {
render() {
return (
{this.props.data.map(item => (
{!item.value && item.loading ? (
) : (
{item.value}
)}
{item.label}
))}
);
}
}
export default DashboardInfoCount;