Skip to content

Commit

Permalink
#1 - done design
Browse files Browse the repository at this point in the history
Next - connect the button progress to the real progress
  • Loading branch information
moshfeu committed Nov 21, 2018
1 parent 9d6d7fa commit 883f413
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 196 deletions.
5 changes: 4 additions & 1 deletion src/components/button-progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';

export interface IButtonProgressProps {
text: string;
onClick: () => void;
}

export interface IButtonProgressState {
Expand Down Expand Up @@ -46,6 +47,8 @@ export class ButtonProgress extends React.Component<IButtonProgressProps, IButto
setTimeout(() => {
makeProgress()
}, Math.random()*500);

this.props.onClick();
}

makeProgress();
Expand All @@ -64,7 +67,7 @@ export class ButtonProgress extends React.Component<IButtonProgressProps, IButto
const { progress } = this.state;

return (
<button className={`progress-button ${this.buttonCssState}`} onClick={this.onClick} data-style="rotate-side-down" data-perspective="" data-horizontal="">
<button className={`button-progress ${this.buttonCssState}`} onClick={this.onClick} data-style="rotate-side-down" data-perspective="" data-horizontal="">
<span className="progress-wrap">
<span className="content">{text}</span>
<span className="progress">
Expand Down
17 changes: 9 additions & 8 deletions src/components/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Video } from './video';
import { IVideoTask } from 'youtube-mp3-downloader';
import { installFfmpeg, isFFMpegInstalled } from '../services/ffmpeg-installer';
import { Form } from './form';
import { ButtonProgress } from './button-progress';

interface IMainState {
playlistUrl: string;
Expand Down Expand Up @@ -130,22 +131,22 @@ class Main extends React.Component<any, IMainState> {
}

public render() {
const { playlistUrl, videos, process, downloadProgress } = this.state;
const { videos, downloadProgress } = this.state;
return (
<div>
<div className="main">
<div className={isFFMpegInstalled() ? '' : 'hidden'}>
<Form
hasResult={!!videos.length}
onSubmit={this.fetchVideosClick}
onClear={() => this.setState({videos: []})}
>
<div>
{videos.length ?
<button onClick={this.downloadAll}>Download All</button> : ''
{videos.length &&
<ButtonProgress text="Download All" onClick={this.downloadAll} />
}
{videos.map(video => (
<Video key={video.id} video={video} onVideoStartClick={this.downloadVideo} />
))}
<div className="videos">
{videos.map(video => (
<Video key={video.id} video={video} onVideoStartClick={this.downloadVideo} />
))}
</div>
</Form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Video extends React.Component<IVideoProps, any> {
{video.name}
</div>
<div className="button">
<ButtonProgress text="Download" />
<ButtonProgress text="Download" onClick={() => console.warn('not yet implemented')} />
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/styles/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$dark-green: #148544;
9 changes: 5 additions & 4 deletions src/styles/components/button-progress.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.progress-button {
/* https://tympanus.net/Development/ProgressButtonStyles/ */
.button-progress {
position: relative;
display: inline-block;
padding: 0;
Expand All @@ -11,7 +12,7 @@
text-transform: uppercase;
letter-spacing: 1px;
font-size: 1em;
line-height: 4;
line-height: 2;

.progress-wrap {
transform-style: preserve-3d;
Expand All @@ -28,15 +29,15 @@
}

.content {
padding: 0 60px;
padding: 0 30px;
background: #1d9650;
position: relative;
display: block;

&::before,
&::after {
position: absolute;
right: 20px;
right: 5px;
color: #0e7138;
font-family: "icomoon";
opacity: 0;
Expand Down
Loading

0 comments on commit 883f413

Please sign in to comment.