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

fix(stepper): Fix the stepper style to make it 'responsive' #166

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
59 changes: 20 additions & 39 deletions components/Step.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<v-stepper-content :step="step_index + 1">
<v-row
align="center"
class="step-container"
class="mb-4 py-2"
@click="set_current_step(step_index)"
>
<v-col cols="auto" class="icon-container">
<v-col cols="auto" class="d-flex justify-center align-center">
<v-icon
v-if="current_step_index > step_index"
icon="mdi-check-circle"
Expand All @@ -22,25 +22,29 @@
color="grey"
/>
</v-col>
<v-col class="title-container">
<p class="step-title font-weight-bold">
<v-col>
<p class="m-0 font-weight-bold">
{{ steps[step_index].step_title }}
</p>
</v-col>
<v-col
<v-chip-group
v-if="
steps[step_index].chips.length && current_step_index >= step_index
"
class="chips-container"
column
class="d-flex flex-wrap ma-2 overflow-y-auto"
multiple
style="max-height: 150px"
>
<v-chip
v-for="(chip, chip_index) in steps[step_index].chips"
:key="chip_index"
class="step-chip"
class="ma-1"
:title="chip"
>
{{ chip }}
{{ truncate(chip, 50) }}
</v-chip>
</v-col>
</v-chip-group>
</v-row>
<component
v-if="step_index == current_step_index"
Expand All @@ -55,6 +59,13 @@
</template>

<script setup>
function truncate(text, maxLength) {
Copy link
Member

Choose a reason for hiding this comment

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

remember this function, I guess you will use the same in the TreeView? If so, you should move it somewhere. @JulienChampagnol where is the bast location? utils ?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah would say utils

if (text.length > maxLength) {
return text.slice(0, maxLength) + "..."
}
return text
}

const props = defineProps({
step_index: { type: Number, required: true },
})
Expand All @@ -80,33 +91,3 @@
stepper_tree.current_step_index--
}
</script>

<style scoped>
.step-container {
margin-bottom: 16px;
padding: 8px;
}

.icon-container {
display: flex;
justify-content: center;
align-items: center;
}

.title-container {
margin-left: 8px;
}

.step-title {
margin: 0;
}

.chips-container {
display: flex;
gap: 4px;
}

.step-chip {
background-color: #f5f5f5;
}
</style>
22 changes: 9 additions & 13 deletions components/Stepper.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<template>
<v-stepper-vertical v-model="current_step_index" class="stepper-container">
<v-stepper-vertical
v-model="current_step_index"
class="pa-4 ma-0"
elevation="1"
rounded
>
<v-stepper-items>
<Step v-for="(step, index) in steps" :key="step" :step_index="index" />
<v-col cols="12">
<Step v-for="(step, index) in steps" :key="step" :step_index="index" />
</v-col>
</v-stepper-items>
</v-stepper-vertical>
</template>
Expand All @@ -10,14 +17,3 @@
const stepper_tree = inject("stepper_tree")
const { steps, current_step_index } = toRefs(stepper_tree)
</script>

<style scoped>
.stepper-container {
max-width: 600px;
margin: 0 auto;
padding: 16px;
background-color: #f9f9f9;
border-radius: 8px;
border: 1px solid #e0e0e0;
}
</style>
Loading