Skip to content

Commit

Permalink
UI-410: Status > remove editable prop (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosarabi committed Jun 25, 2024
1 parent 40a68f2 commit 0291ca2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 13 deletions.
48 changes: 40 additions & 8 deletions packages/alto/src/_dev/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
<script setup lang="ts">
import 'uno.css';
import '../assets/main.css';
import { Loader } from '~/components';
import { ref } from 'vue';
import { Status } from '~/components';
import type { StatusObject } from '~/components/Status/types';
const staticFruit = ref<StatusObject>({
color: '#fffad2',
label: 'Banana 🍌',
labelColor: '#555022',
});
const fruits = [
{
color: '#ffdecb',
label: 'Peach 🍑',
labelColor: '#35192b',
value: 'peach',
},
{
color: '#fffad2',
label: 'Banana 🍌',
labelColor: '#555022',
value: 'banana',
},
{
color: '#cbffd3',
label: 'Kiwi 🥝',
labelColor: '#2c4730',
value: 'kiwi',
},
];
const favoriteFruit = ref<StatusObject>(fruits[0]);
</script>

<template>
<div class="container">
<Loader variant="spinner" label="Loading..." />
<Loader variant="brand" />
<Loader variant="bar" />
<!-- Single status badge -->
<Status :status="staticFruit" />

<!-- Dropdown of badges -->
<Status v-model="favoriteFruit" :status="fruits" />
{{ favoriteFruit }}
</div>
</template>

<style scoped>
.container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
gap: 80px;
margin: 30px;
gap: 0.5rem;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const meta: Meta<typeof Status> = {
layout: 'centered',
},
tags: ['editable', 'editable status', 'status'],
args: {
editable: true,
},
args: {},
};

export const Editable: Story = {
Expand Down
3 changes: 2 additions & 1 deletion packages/alto/src/components/Status/Status.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { defineEmits, defineProps, ref } from 'vue';
import { computed, defineEmits, defineProps, ref } from 'vue';
import { onClickOutside } from '@vueuse/core';
import type { StatusObject, StatusProps } from '~/types';
Expand All @@ -8,6 +8,7 @@ const props = defineProps<StatusProps>();
const emit = defineEmits(['update:modelValue']);
const showDropdown = ref(false);
const editable = computed(() => Array.isArray(props.status));
const list = ref();
const button = ref();
Expand Down
1 change: 0 additions & 1 deletion packages/alto/src/components/Status/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ export interface StatusObject {

export interface StatusProps {
status: StatusObject | StatusObject[]
editable?: boolean
}

0 comments on commit 0291ca2

Please sign in to comment.