ntnyq / vuepress-plugin-social-share

:mega: Social sharing plugin for VuePress
https://social-share.ntnyq.com
MIT License
32 stars 6 forks source link

[Suggestions] #64

Closed Mister-Hope closed 1 year ago

Mister-Hope commented 1 year ago
  1. Could you please open discussion panel?
  2. It would be great if you can import styling tools (not the same as linter) like prettier to make your code style constant. As it would be much easier for others to create pr for you.
  3. Some changes about Api are listed here:

Merge network and extraNetwork

There is no need to provide networks and extraNetworks at same time. There could be only one option network:

// built-in keywords
type SupportedNetwork = 'twitter' | 'facebook' | ...  ;

export interface SocialSharePluginOptions {
  networks?: (SupportedNetwork  | SocialShareNetwork)[]
  // others...
  /** @deprecated use `networks` directly*/
 extraNetWorks?: SocialShareNetwork[]
}

Also, props on components could be updated in the same way. Meanwhile it's easy to add a legacy support.

Update on frontmatter with primary option, as well as marking other options deprecated

It's better to create a scope for social-share in frontmatter, so the new frontmatter options could be:

import { type PageFrontmatter } from "vuepress";

export interface SocialShareFrontmatter {
  enable?: boolean;
  global?: boolean;

  // share meta
  /**
   * Share link
   *
   * @default window.location.href
   */
  url?: string;

  /**
   * Share title
   *
   * @default frontmatter.title
   */
  title?: string;

  /**
   * Share description
   *
   * @default frontmatter.description
   */
  description?: string;

  // ...
}

export interface SocialSharePluginFrontmatter extends PageFrontmatter {
  "social-share"?: SocialShareFrontmatter;

  /** @deprecated use `social-share.enable`  instead  */
  noSocialShare?: boolean;
  /** @deprecated use `social-share.global` instead  */
  noGlobalSocialShare?: boolean;

  // share meta
  /** @deprecated use `social-share.url` instead */
  shareUrl?: string;
  /** @deprecated use `social-share.url` instead */
  $shareUrl?: string;

  /** @deprecated use `social-share.title` instead */
  shareTitle?: string;
  /** @deprecated use `social-share.title` instead */
  $shareTitle?: string;

  // others, should be similar
}

Better style customization and provide custom option

I do think that the default style does not look well, it would be greate to provide some style customization by allowing to override share-button svg through css variables, as well as a new option custom which allows themes or users to provide styles themselves.

ntnyq commented 1 year ago
  1. The dIscussion panel is opened.
  2. I'll add prettier to the project.
Mister-Hope commented 1 year ago

What about the other suggestions, also I would recommend you to convert this issue to discussion

Mister-Hope commented 1 year ago

I will open a few prs later, but I think I might still need to write something on my own.