Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add progress indicator #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/components/progress/ProgressBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script>
import ProgressBlock from "./ProgressBlock.vue";

/* eslint-disable */
export default {

name: "ProgressBar",
components: {
ProgressBlock
}
}
</script>

<template>
<div id="stickyProg">
<ol class="progtrckr" data-progtrckr-steps="7">
<ProgressBlock done="true" block-name="Picked up"/>
<ProgressBlock done="true" block-name="Dropped off"/>
<ProgressBlock block-name="Hello world"/>
<ProgressBlock block-name="Other"/>
<ProgressBlock block-name="Arrived"/>
</ol>
</div>
</template>

<style lang="scss" scoped>
ol.progtrckr {
display: table;
list-style-type: none;
margin: 0;
padding: 0;
table-layout: fixed;
width: 100%;
margin-bottom: 1%;
}
ol.progtrckr[data-progtrckr-steps="2"] li { width: 49%; }
ol.progtrckr[data-progtrckr-steps="3"] li { width: 33%; }
ol.progtrckr[data-progtrckr-steps="4"] li { width: 24%; }
ol.progtrckr[data-progtrckr-steps="5"] li { width: 19%; }
ol.progtrckr[data-progtrckr-steps="6"] li { width: 16%; }
ol.progtrckr[data-progtrckr-steps="7"] li { width: 14%; }
ol.progtrckr[data-progtrckr-steps="8"] li { width: 12%; }
ol.progtrckr[data-progtrckr-steps="9"] li { width: 11%; }


@media (min-width: 880px) {
.progtrckr {
background-color: white;
}
}
</style>
98 changes: 98 additions & 0 deletions src/components/progress/ProgressBlock.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<script>
/* eslint-disable */
export default {
name: "ProgressBlock",
props: {
blockName: String,
done: {
type: Boolean,
default: false
}
},
data() {
return {
isCompleted: this.done // TODO - Set this value dynamically

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably remove the Todo here. Reason being: 'done' will (I assume) be bound to the parent calling whatever instance this is referencing. So in the component here we can trust that this value will be reliable

}
}
}
</script>

<template>
<li :class="[isCompleted ? 'progtrckr-done' : 'progtrckr-todo']">{{ blockName }}</li>
</template>

<style lang="scss" scoped>
li {
display: table-cell;
text-align: center;
line-height: 3em;
white-space: nowrap;
}
ol.progtrckr[data-progtrckr-steps="2"] li { width: 49%; }
ol.progtrckr[data-progtrckr-steps="3"] li { width: 33%; }
ol.progtrckr[data-progtrckr-steps="4"] li { width: 24%; }
ol.progtrckr[data-progtrckr-steps="5"] li { width: 19%; }
ol.progtrckr[data-progtrckr-steps="6"] li { width: 16%; }
ol.progtrckr[data-progtrckr-steps="7"] li { width: 14%; }
ol.progtrckr[data-progtrckr-steps="8"] li { width: 12%; }
ol.progtrckr[data-progtrckr-steps="9"] li { width: 11%; }

li.progtrckr-done {
color: black;
border-bottom: 4px solid #d31534;
}
li.progtrckr-todo {
color: silver;
border-bottom: 4px solid silver;
}

li:after {
content: "\00a0\00a0";
}
li:before {
position: relative;
bottom: -2.5em;
float: left;
left: 50%;
line-height: 1em;
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
}
li.progtrckr-done:before {
content: "\2713";
color: white;
background-color: #d31534;
height: 1.2em;
width: 1.2em;
line-height: 1.2em;
border: none;
border-radius: 1.2em;
}
li.progtrckr-todo:before {
content: "\039F";
color: silver;
background-color: white;
font-size: 1.5em;
bottom: -1.6em;
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
}


@media (max-width: 880px) {
li:after {
display: none;
}
li:before {
display: none;
}
li.progtrckr-todo {
color: rgba(0,0,0,0) !important;
text-indent: -9999px;
}
li.progtrckr-done {
color: rgba(0,0,0,0) !important;
text-indent: -9999px;
}
}
</style>
6 changes: 5 additions & 1 deletion src/views/desktop/UpdateLogView.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<script>
// TODO - build the form, remove this comment when it is done
import UpdateForm from "../../components/busforms/UpdateForm.vue";
import ProgressBar from "../../components/progress/ProgressBar.vue";

export default {
components: { UpdateForm },
components: { UpdateForm, ProgressBar },

};
</script>

<template>
<div class="update">
<ProgressBar />
<UpdateForm />
</div>
</template>
Expand Down