Skip to content

Commit

Permalink
Change Twitter to X
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 committed Jul 31, 2024
1 parent c9e6818 commit 1e33df0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Changed

- Changed Twitter to X

## [0.3.2](https://github.com/dbmdz/mirador-canvaslink/releases/tag/0.3.2) - 2024-02-08

### Fixed
Expand Down
22 changes: 10 additions & 12 deletions src/components/ShareCanvasLinkDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,16 @@ const ShareCanvasLinkDialog = ({
</ScrollIndicatedDialogContent>
<DialogActions className={actions}>
<ButtonGroup className={actionButtons}>
{["envelope", "facebook", "pinterest", "twitter", "whatsapp"].map(
(p) => (
<ShareButton
canvasLink={canvasLink}
key={p}
label={label}
provider={p}
thumbnailUrl={getPreviewUrl(250)}
title={t(`canvasLink.share.${p}`)}
/>
),
)}
{["envelope", "facebook", "pinterest", "x", "whatsapp"].map((p) => (
<ShareButton
canvasLink={canvasLink}
key={p}
label={label}
provider={p}
thumbnailUrl={getPreviewUrl(250)}
title={t(`canvasLink.share.${p}`)}
/>
))}
</ButtonGroup>
<div style={{ flex: "1 0 0" }} />
<Button color="primary" onClick={closeDialog}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/dialog/ShareButton.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import FacebookIcon from "@material-ui/icons/Facebook";
import MailIcon from "@material-ui/icons/Mail";
import PinterestIcon from "@material-ui/icons/Pinterest";
import TwitterIcon from "@material-ui/icons/Twitter";
import WhatsAppIcon from "@material-ui/icons/WhatsApp";
import { MiradorMenuButton } from "mirador/dist/es/src/components/MiradorMenuButton";
import PropTypes from "prop-types";
import React from "react";

import XIcon from "../icons/XIcon";
import { getShareLink } from "../utils";

const iconMapping = {
envelope: MailIcon,
facebook: FacebookIcon,
pinterest: PinterestIcon,
twitter: TwitterIcon,
whatsapp: WhatsAppIcon,
x: XIcon,
};

/** Renders a button for sharing the given content on one of the supported providers */
Expand Down
11 changes: 11 additions & 0 deletions src/components/icons/XIcon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { SvgIcon } from "@material-ui/core";
import React from "react";

/* FIXME: should not be needed anymore when upgrading to MUI 5 */
const XIcon = () => (
<SvgIcon viewBox="0 0 24 24">
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
</SvgIcon>
);

export default XIcon;
8 changes: 4 additions & 4 deletions src/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const getShareLink = (
return `https://www.facebook.com/sharer/sharer.php?title=${text}&u=${canvasLink}`;
case "pinterest":
return `http://pinterest.com/pin/create/bookmarklet/?url=${canvasLink}&description=${text}&media=${thumbnailUrl}`;
case "twitter":
return `https://twitter.com/intent/tweet?text=${
text.length > 60 ? `${text.substring(0, 60)}...` : text
}&url=${canvasLink}&hashtags=iiif`;
case "whatsapp":
return `whatsapp://send?text=${text}: ${canvasLink}`;
case "x":
return `https://x.com/intent/post?text=${
text.length > 60 ? `${text.substring(0, 60)}...` : text
}&url=${canvasLink}&hashtags=iiif`;
default:
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default {
envelope: "Per Mail teilen",
facebook: "Auf Facebook teilen",
pinterest: "Auf Pinterest teilen",
twitter: "Auf Twitter teilen",
whatsapp: "Per WhatsApp teilen",
x: "Auf X teilen",
},
shareLink: "Link auf diese Seite teilen",
},
Expand All @@ -27,8 +27,8 @@ export default {
envelope: "Share via mail",
facebook: "Share on Facebook",
pinterest: "Share on Pinterest",
twitter: "Share on Twitter",
whatsapp: "Share via WhatsApp",
x: "Share on X",
},
shareLink: "Share link to this page",
},
Expand Down

0 comments on commit 1e33df0

Please sign in to comment.