gitsindonesia / ui-component

Morpheme UI - Free and Open-source Vue 3 Component Library based on Morpheme Design System
https://ui.morpheme.design
MIT License
75 stars 5 forks source link

feat(Modal): add new declarative modal components #177

Closed gravitano closed 1 year ago

gravitano commented 1 year ago

πŸ”— Linked issue

❓ Type of change

πŸ“š Description

This PR introduced a new declarative approach to use the modal component, providing you with enhanced flexibility. This approach involves breaking down the modal component into five separate components, each serving a specific purpose. To utilize this feature, you will need to manually import these components.

Component List

The modal components are as follows:

Usage

Unlike before, these components are not auto-imported. Therefore, you must import them individually based on your requirements.

Here's a brief overview of each modal component and its purpose:

Example

<script setup lang="ts">
import {
  VBtn,
  Modal,
  ModalHeader,
  ModalTitle,
  ModalFooter,
  ModalBody,
} from '@morpheme/ui';

const isOpen = ref(false);
</script>

<template>
  <VBtn @click="isOpen = true">Open Modal</VBtn>

  <Modal v-model="isOpen" v-bind="params">
    <ModalHeader>
      <ModalTitle>Modal Title</ModalTitle>
      <VBtn
        @click="isOpen = false"
        prefix-icon="ri:close-line"
        size="sm"
        text
        icon
        fab
      />
    </ModalHeader>
    <ModalBody>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
    </ModalBody>
    <ModalFooter>
      <VBtn @click="isOpen = false">Close</VBtn>
      <VBtn @click="isOpen = false" color="primary">Okay</VBtn>
    </ModalFooter>
  </Modal>
</template>

πŸ“ Checklist