import { Meta, Story, Preview} from "@storybook/addon-docs/blocks"
import STwitter from "../STwitter"

<Meta title='Share/STwitter' component={ STwitter } />

<style>{`
  .custom-preview .base-canvas {
    height: auto;
  }
`}</style>

# STwitter

## Preview

<Preview className="custom-preview">
  <Story id='share-stwitter--default' />
</Preview>

## Example

```html
<template>
  <s-twitter
    :window-features="windowFeatures"
    :share-options="shareOptions"
    :use-native-behavior="useNativeBehavior"
    @popup-close="onClose"
    @popup-open="onOpen"
    @popup-block="onBlock"
    @popup-focus="onFocus"
  ></s-twitter>
</template>

<script>
  import { STwitter } from 'vue-socials'

  export default {
    name: 'STwitterSharing',

    components: { STwitter },

    data() {
      return {
        windowFeatures: {},
        shareOptions: {
          url: 'https://github.com/',
          text: 'Hello world',
          hashtags: ['hash', 'tag'],
          via: 'twitterdev',
        },
        useNativeBehavior: false,
      }
    },

    methods: {
      onClose() {},
      onOpen() {},
      onBlock() {},
      onFocus() {},
    }
  };
</script>
```

## Props

| Prop | Type | Description | Default value |
| ------ | ------ | ------ | ------ |
`windowFeatures` | `object` | Pass options to `window.open()`. [Requested features of the new window.](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#window_features) | `{ width: 600, height: 540, }`
`shareOptions` | `object` | Your share link parameters: <br /> **url** – the URL you want to share <br /> **text** – post text <br /> **via** – username  <br /> **hashtags** – list of tags <br />  | `{}`
`useNativeBehavior` | `boolean` | Use native link behavior instead of `window.open()` or not | `false`

## Events

| Event name | Usage |
| ------ | ------ |
`popup-open` | `window.open()` has been opened |
`popup-close` | `window.open()` has been closed |
`popup-block` | `window.open()` has been blocked |
`popup-focus` | `window.open()` has been focused |

