Skip to content

Commit

Permalink
Fix style problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
noorzaie committed May 21, 2019
1 parent 5d1b1b2 commit 08cb419
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 131 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# vue-count-down-timer

This is a count down timer for Vue js framework. This library supports two types of timers:
1. Timer mode: Timer based on hour, minute and second.
2. Single mode: Timber based on second (single circle without hours and minutes).

## Installation
```
npm install vuejs-circular-count-down-timer
npm install vue-circular-count-down-timer
```
After installation, import component:
```
import CircularCountDownTimer from "vuejs-circular-count-down-timer";
import CircularCountDownTimer from "vue-circular-count-down-timer";
```

### Documentation

| Props | Description |
| --- | --- |
| initial_value | Initial value of timer, as seconds. (required) |
| initial-value | Initial value of timer, as seconds. (required) |
| stroke-width | Thickness of circle strokes in px. |
| seconds-stroke-color | Color of stroke of seconds circle. |
| minutes-stroke-color | Color of stroke of minutes circle. |
Expand All @@ -38,12 +40,12 @@ import CircularCountDownTimer from "vuejs-circular-count-down-timer";

| Events | Description |
| --- | --- |
| finish | Fires when counter reach zero. |
| finish | Fires when counter reaches zero. |
| update | Fires on each counting. |

### Usage

#### 1. basic timer
#### 1. Basic usage

```
<CircularCountDownTimer
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuejs-circular-count-down-timer",
"version": "0.1.0",
"name": "vue-circular-count-down-timer",
"version": "1.0.2",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
17 changes: 0 additions & 17 deletions public/index.html

This file was deleted.

85 changes: 66 additions & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,75 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
<div id="app">
<CircularCountDownTimer
:initial-value="360500"
:stroke-width="5"
:seconds-stroke-color="'#f00'"
:minutes-stroke-color="'#0ff'"
:hours-stroke-color="'#0f0'"
:underneath-stroke-color="'lightgrey'"
:seconds-fill-color="'#00ffff66'"
:minutes-fill-color="'#00ff0066'"
:hours-fill-color="'#ff000066'"
:size="200"
:padding="14"
:hour-label="'hours'"
:minute-label="'minutes'"
:second-label="'seconds'"
:show-second="true"
:show-minute="true"
:show-hour="true"
:show-negatives="true"
:paused="some_variable"
></CircularCountDownTimer>
<!--<CircularCountDownTimer
:initial-value="200"
:steps="400"
@finish="finished"
@update="updated"
></CircularCountDownTimer>-->
</div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
// import HelloWorld from './components/HelloWorld.vue'
import CircularCountDownTimer from "./components/CircularCountDownTimer";
export default {
name: 'app',
components: {
HelloWorld
}
}
export default {
name: 'app',
components: {
// HelloWorld,
CircularCountDownTimer
},
data(){
return {
pause: false
}
},
mounted(){
setTimeout(function(){
this.pause = true;
}.bind(this), 30000);
},
methods: {
finished: () => {
console.log('finished')
},
updated: (status) => {
console.log(status)
}
}
}
</script>

<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
#app {
height: 200px;
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
background-color: aliceblue;
}
</style>
Binary file removed src/assets/logo.png
Binary file not shown.
27 changes: 6 additions & 21 deletions src/components/CircularCountDownTimer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<div
id="wrapper"
ref="wrapper"
:style="{width: 'auto', height: container_height+'px', boxSizing: 'border-box'}"
:style="{width: 'auto', height: container_height+'px', boxSizing: 'border-box', display: 'flex', justifyContent: 'center', 'alignItems': 'center'}"
>
<div
id="container"
:style="{width: container_width+'px', height: container_height+'px', paddingTop: padding+'px'}"
:style="{width: container_width+'px', height: container_height+'px', paddingTop: padding+'px', margin: '0 auto', boxSizing: 'border-box'}"
>
<div
v-if="!is_single && showHour"
class="item"
:style="{width: inner_size+'px', height: inner_size+'px', paddingLeft: padding+'px', paddingRight: padding+'px'}"
:style="{width: inner_size+'px', height: inner_size+'px', paddingLeft: padding+'px', paddingRight: padding+'px', float: 'left', direction: 'ltr'}"
>
<div :style="{width: inner_size+'px', height: inner_size+'px', lineHeight: inner_size+'px', position: 'absolute', fontSize: number_font_size+'px'}">
{{ factor * hours }}
Expand Down Expand Up @@ -49,7 +49,7 @@
<div
v-if="!is_single && showMinute"
class="item"
:style="{width: inner_size+'px', height: inner_size+'px', paddingLeft: padding+'px', paddingRight: padding+'px'}"
:style="{width: inner_size+'px', height: inner_size+'px', paddingLeft: padding+'px', paddingRight: padding+'px', float: 'left', direction: 'ltr'}"
>
<div :style="{width: inner_size+'px', height: inner_size+'px', lineHeight: inner_size+'px', position: 'absolute', fontSize: number_font_size+'px'}">
{{ factor * minutes }}
Expand Down Expand Up @@ -87,7 +87,7 @@
<div
v-if="showSecond"
class="item"
:style="{width: inner_size+'px', height: inner_size+'px', paddingLeft: padding+'px', paddingRight: padding+'px'}"
:style="{width: inner_size+'px', height: inner_size+'px', paddingLeft: padding+'px', paddingRight: padding+'px', float: 'left', direction: 'ltr'}"
>
<div :style="{width: inner_size+'px', height: inner_size+'px', lineHeight: inner_size+'px', position: 'absolute', fontSize: number_font_size+'px'}">
{{ factor * seconds }}
Expand Down Expand Up @@ -322,6 +322,7 @@
this.$emit('finish');
}
if(this.value <= 0 && !this.showNegatives){
this.value = 0;
clearInterval(interval);
}
else{
Expand All @@ -339,22 +340,6 @@
</script>

<style scoped>
.item{
float: left;
direction: ltr;
}
#wrapper{
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
#container{
margin: 0 auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
circle{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
Expand Down
58 changes: 0 additions & 58 deletions src/components/HelloWorld.vue

This file was deleted.

15 changes: 6 additions & 9 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import Vue from 'vue';
import CircularCountDownTimer from './CircularCountDownTimer'

const Components = {
CircularCountDownTimer
export default {
install(Vue, options) {
// Let's register our component globally
// https://vuejs.org/v2/guide/components-registration.html
Vue.component("circular-count-down-timer", CircularCountDownTimer);
}
};

Object.keys(Components).forEach(name => {
Vue.component(name, Components[name]);
});

export default Components;

0 comments on commit 08cb419

Please sign in to comment.