GithubHelp home page GithubHelp logo

sttatusx / vue-share-modal Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 240 KB

A pure, lightweight, and beautiful share modal for Vue3 (SFC)

Home Page: https://freakingeek.github.io/vue-share-modal/

License: ISC License

JavaScript 27.79% Vue 60.41% TypeScript 11.80%
vue share-modal sfc

vue-share-modal's Introduction

vue-share-modal

A pure, lightweight, and beautiful share modal for Vue 3
โ€Œ

screenshot

โ€Œ

๐Ÿช Live version

You can see the live version here:
https://freakingeek.github.io/vue-share-modal/

โ€Œ

๐Ÿ’พ Install

$ yarn add vue-share-modal
# npm install vue-share-modal

Or you can use any package manager you want

โ€Œ

๐Ÿš€ Usage

You should import share-modal and share-module components from the vue-share-modal package and use them like this.
โ€Œ

<template>
  <share-modal
    :show="showModal"
    @update:show="showModal = false"
    link="https://www.figma.com/community/file/999287868143091993"
  >
    <template v-for="(m, key) in modules" :key="key">
      <share-module tag="a" href="#" :name="m.name">
        <component :is="m.component" />
      </share-module>
    </template>
  </share-modal>
</template>

<script>
import ShareModal from "vue-share-modal";
import ShareModule from "vue-share-modal/src/components/share-module.vue";
import { ChatCircle, Instagram, Twitch, At, Share, Twitter } from "@salmon-ui/icons";

export default {
  name: "MyComponent",

  components: {
    At,
    Share,
    Twitch,
    Twitter,
    Instagram,
    ChatCircle,
    ShareModal,
    ShareModule,
  },

  data() {
    return {
      showModal: true,
    };
  },

  computed: {
    modules() {
      return [
        { name: "Chat", component: ChatCircle },
        { name: "Instagram", component: Instagram },
        { name: "Twitter", component: Twitter },
        { name: "Twitch", component: Twitch },
        { name: "E-mail", component: At },
        { name: "More", component: Share },
      ];
    },
  },
};
</script>

โ€Œ

NOTE: vue-share-modal does not contain any icons by default. So we use @salmon-ui/icons package for example here

โ€Œ

Options Or Props ( share-modal )

show prop is used for showing modal with animation
@update:show event is used to update show value

<share-modal
  :show="showModal"
  @update:show="showModal = false"
/>

โ€Œ

link prop is used for showing link in the footer

<share-modal
  link="https://www.figma.com/community/file/999287868143091993"
/>

โ€Œ

mode prop is used for changing modal style ( normal / outline )

<share-modal
  mode="outline"
/>

โ€Œ

direction prop is used for changing modal direction ( ltr / rtl )

<share-modal
  direction="rtl"
/>

โ€Œ

title prop is used for changing modal title

<share-modal
  title="Share with"
/>

โ€Œ

footerHint prop is used for changing the footer text

<share-modal
  footerHint="Or share with link"
/>

โ€Œ

variables prop is used for changing the modal CSS variables ( like font-family and colors )

<share-modal
  :variables="{
    fontFamily: 'Inter, sans-serif',
    red: '#ee4d4d',
    white: '#fefefe',
    primary: '#ee6c4d',
    primaryLight: '#ee6c4d08',
    secondary: '#3d5a80',
    secondaryLight: '#3d5a8096',
  }"
/>

โ€Œ

Options Or Props ( share-module )

tag generated tag for share-module component ( default: span )

<share-module
  tag="a"
/>

โ€Œ

name name of the module

<share-module
  tag="a"
  name="Pinterest"
/>

โ€Œ

iconClassName you can pass this prop to use font icons

<share-module
  tag="a"
  name="Twitter"
  iconClassName="bi bi-twitter"
/>

โ€Œ

mode you can pass this prop to overwrite share-modal mode prop

<share-modal mode="outline">
  <share-module
    tag="a"
    mode="normal"
  />
</share-modal>

โ€Œ

โœ Todo

  • Support for different themes

    โ€Œ

๐Ÿ“ License

This project is under ISC license

vue-share-modal's People

Contributors

freakingeek avatar mekdrop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-share-modal's Issues

Copy button

Copy button works on local but it doesn't copy the link when the app is on the server. I tried on Firefox and Chrome... The demo version in the read me works as well. What can be the issue? It is the exact same code...

How to remove the copy button so users use the link by selecting and copying instead of the button...? It can also solve the problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.