mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
parent
6a1a9c6ce9
commit
5adc5f4c7a
5 changed files with 50 additions and 11 deletions
27
frontend/components/ProgressBar/ProgressBar.jsx
Normal file
27
frontend/components/ProgressBar/ProgressBar.jsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import React, { Component, PropTypes } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { round } from 'lodash';
|
||||
|
||||
const baseClass = 'progress-bar';
|
||||
|
||||
class ProgressBar extends Component {
|
||||
static propTypes = {
|
||||
className: PropTypes.string,
|
||||
max: PropTypes.number.isRequired,
|
||||
value: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
const { className, max, value } = this.props;
|
||||
const percentComplete = `${(round((value / (max || 1)) * 100, 0))}%`;
|
||||
const wrapperClassName = classnames(baseClass, className);
|
||||
|
||||
return (
|
||||
<div className={wrapperClassName}>
|
||||
<div style={{ width: percentComplete }} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ProgressBar;
|
||||
12
frontend/components/ProgressBar/_styles.scss
Normal file
12
frontend/components/ProgressBar/_styles.scss
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
.progress-bar {
|
||||
background-color: $success-light;
|
||||
height: 10px;
|
||||
overflow: hidden;
|
||||
|
||||
div {
|
||||
background-color: $success;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
transition: width 300ms ease-in;
|
||||
}
|
||||
}
|
||||
1
frontend/components/ProgressBar/index.js
Normal file
1
frontend/components/ProgressBar/index.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default from './ProgressBar';
|
||||
|
|
@ -2,10 +2,10 @@ import React, { Component } from 'react';
|
|||
import { connect } from 'react-redux';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import Avatar from '../../components/Avatar';
|
||||
import Rocker from '../../components/buttons/Rocker';
|
||||
import paths from '../../router/paths';
|
||||
import userInterface from '../../interfaces/user';
|
||||
import Avatar from 'components/Avatar';
|
||||
import paths from 'router/paths';
|
||||
import ProgressBar from 'components/ProgressBar';
|
||||
import userInterface from 'interfaces/user';
|
||||
|
||||
export class HomePage extends Component {
|
||||
static propTypes = {
|
||||
|
|
@ -16,19 +16,13 @@ export class HomePage extends Component {
|
|||
const { user } = this.props;
|
||||
const { LOGOUT } = paths;
|
||||
const baseClass = 'home-page';
|
||||
const rockerOpts = {
|
||||
aText: 'List',
|
||||
aIcon: 'list-select',
|
||||
bText: 'Grid',
|
||||
bIcon: 'grid-select',
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={baseClass}>
|
||||
{user && <Avatar size="small" className={`${baseClass}__avatar`} user={user} />}
|
||||
<span>You are successfully logged in! </span>
|
||||
{user && <Link to={LOGOUT}>Logout</Link>}
|
||||
<Rocker name="view-type" value="grid" options={rockerOpts} />
|
||||
<ProgressBar className={`${baseClass}__progress-bar`} max={100} value={35} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,9 @@
|
|||
margin-right: $pad-xsmall;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
&__progress-bar {
|
||||
margin-top: $pad-base;
|
||||
width: 378px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue