-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from LucasWerey/feat/14
feat(dslib): add delete modal
- Loading branch information
Showing
11 changed files
with
156 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ You will find the last version of the library here : https://github.com/LucasWer | |
In your main project import the library : | ||
|
||
```bash | ||
yarn add @lucaswerey/[email protected].55 | ||
yarn add @lucaswerey/[email protected].57 | ||
``` | ||
|
||
## Use docker | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { mount } from '@vue/test-utils' | ||
import { it, describe, expect } from 'vitest' | ||
import DeleteModal from '.' | ||
|
||
describe('DeleteModal', () => { | ||
it('renders the title and description correctly', () => { | ||
const wrapper = mount(DeleteModal, { | ||
props: { | ||
title: 'Test Title', | ||
description: 'Test Description' | ||
} | ||
}) | ||
expect(wrapper.text()).toContain('Test Title') | ||
expect(wrapper.text()).toContain('Test Description') | ||
}) | ||
|
||
it('emits FirstButtonClicked when the first button is clicked', async () => { | ||
const wrapper = mount(DeleteModal) | ||
await wrapper.findAllComponents({ name: 'Button' })[0].trigger('click') | ||
expect(wrapper.emitted()).toHaveProperty('FirstButtonClicked') | ||
}) | ||
|
||
it('emits SecondButtonClicked when the second button is clicked', async () => { | ||
const wrapper = mount(DeleteModal) | ||
await wrapper.findAllComponents({ name: 'Button' })[1].trigger('click') | ||
expect(wrapper.emitted()).toHaveProperty('SecondButtonClicked') | ||
}) | ||
}) |
53 changes: 53 additions & 0 deletions
53
src/components/Indicators/DeleteModal/DeleteModal.story.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<Story | ||
title="Delete Modal" | ||
group="indicators" | ||
:layout="{ | ||
type: 'grid', | ||
width: '80%' | ||
}" | ||
> | ||
<template #controls> | ||
<ControlDescription> | ||
<HstText v-model="controls.title" title="Title" /> | ||
</ControlDescription> | ||
<ControlDescription> | ||
<HstText v-model="controls.description" title="Description" /> | ||
</ControlDescription> | ||
<ControlDescription> | ||
<HstText v-model="controls.labelFirstButton" title="LabelFirstButton" /> | ||
</ControlDescription> | ||
<ControlDescription> | ||
<HstText v-model="controls.labelSecondButton" title="LabelSecondButton" /> | ||
</ControlDescription> | ||
</template> | ||
|
||
<Variant title="Playground" auto-props-disabled> | ||
<DeleteModal | ||
:title="controls.title" | ||
:description="controls.description" | ||
:labelFirstButton="controls.labelFirstButton" | ||
:labelSecondButton="controls.labelSecondButton" | ||
@FirstButtonClicked="logEvent('FirstButtonClicked', $event)" | ||
@SecondButtonClicked="logEvent('SecondButtonClicked', $event)" | ||
/> | ||
</Variant> | ||
</Story> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { logEvent } from 'histoire/client' | ||
interface Controls { | ||
title: string | ||
description: string | ||
labelFirstButton: string | ||
labelSecondButton: string | ||
} | ||
const controls = reactive<Controls>({ | ||
title: 'Title', | ||
description: '', | ||
labelFirstButton: 'LabelButton', | ||
labelSecondButton: 'LabelButton' | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<template> | ||
<div | ||
class="flex min-h-44 w-[300px] flex-col items-center gap-8 overflow-hidden rounded-3xl bg-basic-white p-6 shadow sm:w-[400px]" | ||
> | ||
<div class="flex w-full flex-col items-center gap-4"> | ||
<div class="text-center font-inter text-8">{{ title }}</div> | ||
<div v-show="description" class="text-center font-eina1 text-3 font-normal"> | ||
{{ description }} | ||
</div> | ||
</div> | ||
<div class="flex w-full flex-row gap-3 text-3"> | ||
<Button | ||
class="overflow-hidden" | ||
type="default" | ||
state="active" | ||
styled="outlined" | ||
style="border-color: #d1d1d1; color: #000000" | ||
@click="emit('FirstButtonClicked')" | ||
> | ||
{{ labelFirstButton }} | ||
</Button> | ||
<Button | ||
class="overflow-hidden" | ||
type="default" | ||
state="active" | ||
styled="fill" | ||
style="border-color: #ff5656; background-color: #ff5656" | ||
@click="emit('SecondButtonClicked')" | ||
> | ||
{{ labelSecondButton }} | ||
</Button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps({ | ||
title: { | ||
type: String as PropType<string>, | ||
default: 'Title' | ||
}, | ||
description: { | ||
type: String as PropType<string> | ||
}, | ||
labelFirstButton: { | ||
type: String as PropType<string>, | ||
default: 'LabelButton' | ||
}, | ||
labelSecondButton: { | ||
type: String as PropType<string>, | ||
default: 'LabelButton' | ||
} | ||
}) | ||
const title = computed(() => props.title) | ||
const description = computed(() => props.description) | ||
const labelFirstButton = computed(() => props.labelFirstButton) | ||
const labelSecondButton = computed(() => props.labelSecondButton) | ||
const emit = defineEmits(['FirstButtonClicked', 'SecondButtonClicked']) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './DeleteModal.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters