-
-
Notifications
You must be signed in to change notification settings - Fork 52
feat: add Nuxt.js integration wrapper and demo documentation #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amankv1234
wants to merge
23
commits into
AOSSIE-Org:main
Choose a base branch
from
amankv1234:Aman-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d3e596f
refactor: improve error handling and fix demo page structure
amankv1234 6d7adaa
refactor: improve error handling and clean up demo page structure
amankv1234 ea1aa48
refactor: improve error handling and clean up demo page structure
amankv1234 ee7d778
feat: add WordPress integration guide and demo section
amankv1234 dd06a62
fixed
amankv1234 53d6533
fix: escape raw arrow operator in code snippet
amankv1234 4f2dbd4
fixed
amankv1234 17b04a1
fix: correct WordPress CDN URLs and wp_footer hook priority
amankv1234 d3c3014
fix: silence intentional catch block in fallback copy
amankv1234 5c60421
feat: add Nuxt.js integration wrapper and demo documentation
amankv1234 f9fc038
fixed
amankv1234 c77cb74
fixed
amankv1234 61c4bfc
fixed +
amankv1234 1bd46c1
fixed
amankv1234 de25b72
fixed
amankv1234 175aad3
fixed
amankv1234 93ba04c
fix
amankv1234 c28cfde
fixed
amankv1234 6d67726
Merge branch 'main' into Aman-1
amankv1234 d2585c8
video link added and readme updated
amankv1234 982136d
Fix reviewer feedback: remove empty list item, add pinterest to preacβ¦
amankv1234 93ef0ae
Merge branch 'main' into Aman-1
amankv1234 3efdaa1
Merge branch 'main' into Aman-1
amankv1234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| <template> | ||
| <div ref="container"></div> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { ref, onMounted, onBeforeUnmount, watch } from 'vue'; | ||
|
|
||
| const props = defineProps({ | ||
| url: { type: String, default: '' }, | ||
| title: { type: String, default: '' }, | ||
| description: { type: String, default: '' }, | ||
| hashtags: { type: Array, default: () => [] }, | ||
| via: { type: String, default: '' }, | ||
| platforms: { type: Array, default: () => ['whatsapp', 'facebook', 'twitter', 'linkedin', 'telegram', 'reddit', 'pinterest'] }, | ||
| theme: { type: String, default: 'dark' }, | ||
| buttonText: { type: String, default: 'Share' }, | ||
| customClass: { type: String, default: '' }, | ||
| onShare: { type: Function, default: null }, | ||
| onCopy: { type: Function, default: null }, | ||
| buttonStyle: { type: String, default: 'default' }, | ||
| modalPosition: { type: String, default: 'center' }, | ||
| buttonColor: { type: String, default: '' }, | ||
| buttonHoverColor: { type: String, default: '' }, | ||
| showButton: { type: Boolean, default: true }, | ||
| // Analytics | ||
| analytics: { type: Boolean, default: true }, | ||
| onAnalytics: { type: Function, default: null }, | ||
| analyticsPlugins: { type: Array, default: () => [] }, | ||
| componentId: { type: String, default: null }, | ||
| debug: { type: Boolean, default: false } | ||
| }); | ||
|
amankv1234 marked this conversation as resolved.
|
||
|
|
||
| const container = ref(null); | ||
| let shareButton = null; | ||
|
|
||
| onMounted(() => { | ||
| // SSR guard β Nuxt pre-renders on the server | ||
| if (typeof window !== 'undefined' && window.SocialShareButton) { | ||
| shareButton = new window.SocialShareButton({ | ||
| container: container.value, | ||
| url: props.url || window.location.href, | ||
| title: props.title || document.title, | ||
| description: props.description, | ||
| hashtags: props.hashtags, | ||
| via: props.via, | ||
| platforms: props.platforms, | ||
| theme: props.theme, | ||
| buttonText: props.buttonText, | ||
| customClass: props.customClass, | ||
| onShare: props.onShare, | ||
| onCopy: props.onCopy, | ||
| buttonStyle: props.buttonStyle, | ||
| modalPosition: props.modalPosition, | ||
| buttonColor: props.buttonColor, | ||
| buttonHoverColor: props.buttonHoverColor, | ||
| showButton: props.showButton, | ||
| analytics: props.analytics, | ||
| onAnalytics: props.onAnalytics, | ||
| analyticsPlugins: props.analyticsPlugins, | ||
| componentId: props.componentId, | ||
| debug: props.debug | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| onBeforeUnmount(() => { | ||
| if (shareButton) { | ||
| shareButton.destroy(); | ||
| shareButton = null; | ||
| } | ||
| }); | ||
|
|
||
| // Sync prop changes to the underlying vanilla JS instance (e.g. Nuxt route changes) | ||
| watch(props, (newProps) => { | ||
| if (shareButton) { | ||
| const currentUrl = newProps.url || (typeof window !== 'undefined' ? window.location.href : ''); | ||
| const currentTitle = newProps.title || (typeof document !== 'undefined' ? document.title : ''); | ||
|
|
||
| shareButton.updateOptions({ | ||
| ...newProps, | ||
| url: currentUrl, | ||
| title: currentTitle | ||
| }); | ||
| } | ||
| }, { deep: true }); | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.