Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
10e81814
Commit
10e81814
authored
Nov 07, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Nov 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert ShareLinks to TypeScript
parent
a3f465da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
21 deletions
+15
-21
ShareLinks.tsx
src/sidebar/components/ShareLinks.tsx
+15
-21
No files found.
src/sidebar/components/ShareLinks.
js
→
src/sidebar/components/ShareLinks.
tsx
View file @
10e81814
...
...
@@ -4,24 +4,23 @@ import {
SocialFacebookIcon
,
SocialTwitterIcon
,
}
from
'@hypothesis/frontend-shared/lib/next'
;
import
type
{
IconComponent
}
from
'@hypothesis/frontend-shared/lib/types'
;
/**
* @typedef {import('@hypothesis/frontend-shared/lib/types').IconComponent} IconComponent
*/
type
ShareLinkProps
=
{
/** The SVG icon component to use for this link */
icon
:
IconComponent
;
/**
* @typedef ShareLinkProps
* @prop {IconComponent} icon - The SVG icon component to use for this link
* @prop {string} label - Accessible label/tooltip for link
* @prop {string} uri - URI for sharing this annotation
*/
/** Accessible label/tooltip for link */
label
:
string
;
/** URI for sharing this annotation */
uri
:
string
;
};
/**
* A single sharing link as a list item
*
* @param {ShareLinkProps} props
*/
function
ShareLink
({
label
,
icon
:
Icon
,
uri
})
{
function
ShareLink
({
label
,
icon
:
Icon
,
uri
}
:
ShareLinkProps
)
{
return
(
<
li
>
<
LinkBase
...
...
@@ -41,19 +40,14 @@ function ShareLink({ label, icon: Icon, uri }) {
);
}
/**
* @typedef ShareLinksProps
* @prop {string} shareURI - The URL to share
*/
export
type
ShareLinksProps
=
{
shareURI
:
string
;
};
/**
* A list of share links to social-media platforms.
*
* @param {ShareLinksProps} props
*/
export
default
function
ShareLinks
({
shareURI
})
{
// This is the double-encoded format needed for other services (the entire
// URI needs to be encoded because it's used as the value of querystring params)
export
default
function
ShareLinks
({
shareURI
}:
ShareLinksProps
)
{
const
encodedURI
=
encodeURIComponent
(
shareURI
);
return
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment