Skip to content

Commit

Permalink
feat: add comment to types
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnyq committed Mar 12, 2024
1 parent c936090 commit 929da0d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineUserConfig({
- **type:** `string[]`
- **default** `['twitter', 'facebook', 'reddit']`

Default networks set for all your social share component, no matter it's in global or local mode.
Default networks set for all your social share components, no matter it's in global or local mode.

Currently, networks below are built-in supported:

Expand Down
2 changes: 1 addition & 1 deletion src/client/components/SocialShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const SocialShare = defineComponent({
() =>
frontmatter.value.$shareQuote ??
frontmatter.value.shareQuote ??
(options.autoQuote ? description.value : ''),
(options.autoQuote ?? true ? description.value : ''),
)
const hashtags = computed(() => {
const tags =
Expand Down
62 changes: 61 additions & 1 deletion src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export type SocialShareNetworkItem = SocialShareNetwork & { name: string }

export type SocialShareNetworkData = Record<string, SocialShareNetwork>

/**
* QRCode options, alias of `QRCodeToDataURLOptions`
*
* @see {@link https://github.com/soldair/node-qrcode?tab=readme-ov-file#options-2}
*/
export type SocialShareQRCodeOptions = QRCodeToDataURLOptions

export interface SocialShareFrontmatter {
Expand Down Expand Up @@ -46,17 +51,72 @@ export interface SocialShareFrontmatter {
}

export interface SocialSharePluginOptions {
/**
* Custom component name of `SocialShare`
*
* @default 'SocialShare'
*/
componentName?: string

/**
* Set to `true` to disable built-in style
*
* @default false
*/
useCustomStyle?: boolean

/**
* Default networks set for all your social share components
*
* @default ['twitter', 'facebook', 'reddit']
*/
networks?: string[]

/**
* Twitter profile username
*/
twitterUser?: string

/**
* A fallback share image. A network image URL or a local image path based on `/public`
*/
fallbackImage?: string

/**
* Set to `true` to enable plain mode
*
* @default false
*/
isPlain?: boolean

/**
* @default true
*/
autoQuote?: boolean

/**
* Set to `true` to disable global social share
*
* @default false
*/
noGlobalSocialShare?: boolean

/**
* QRCode options
* @see {@link https://github.com/soldair/node-qrcode?tab=readme-ov-file#options-2}
*/
qrcodeOptions?: SocialShareQRCodeOptions
extendsNetworks?: Record<string, SocialShareNetwork>

/**
* Add user customed networks or overrides built-in networks
*/
extendsNetworks?: SocialShareNetworkData

/**
* Set to `true` to hide SocialShare when printing
*
* @default false
*/
hideWhenPrint?: boolean
}

Expand Down

0 comments on commit 929da0d

Please sign in to comment.