Lehoczky/vue-termynal

Improve the progress component

Closed this issue · 3 comments

rakr commented

The current issues I am seeing with the progress component:

  1. It is a div which means that it is always on its own line.
  2. It is not possible to write text before the progress bar, for instance it is not possible to simulate
Uninstall in progress: ------------- 45%
  1. It only simulates "known progress", for example:
Uninstall in progress: ⢸

Text before the line

You can add text before the bar by using CSS:

<template>
  <v-termynal>
    <vt-progress class="uninstall" :progress-length="30" />
  </v-termynal>
</template>

<style>
.uninstall::before {
  content: "Uninstall in progress:";
  padding-right: 5px;
}
</style>

I can add an example to the docs if you think this is a good a solution the problem.

Indeterminate progress

I like the idea of it. We could create a new component for this, and this way the original progress component could stay simpler and the user can import the progress indicator they need.

about the div

The progress line is a <span> element but with the display: block style. You can change this with CSS too by overriding the default style of the .vt__line class.

Let me know if this helped you with your use case!

rakr commented

I tried adding the text before in the CSS, but in my use case it became quickly overwhelming, to many classes as I had several progress components.

I have raised this PR #4 that solves these two topics, using a slot like for vt-input, and adding adding the property progress-unknown to the progress component.

Let me know your thoughts.

You could use the attr() css function to dynamically set the content of the ::before element, but at this point I agree, that using slot is simpler and more intuitive.