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 69caa72 commit 9d4bb51
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 22 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Unreleased

### Changed

- Changed Twitter to X

## [0.1.8](https://github.com/dbmdz/mirador-imagecropper/releases/tag/0.1.8) - 2024-02-21

Expand Down
24 changes: 11 additions & 13 deletions src/components/CroppingDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,17 @@ const CroppingDialog = ({
</ScrollIndicatedDialogContent>
<DialogActions className={actions}>
<ButtonGroup className={actionButtons}>
{["envelope", "facebook", "pinterest", "twitter", "whatsapp"].map(
(p) => (
<ShareButton
attribution={attribution}
imageUrl={imageUrl}
key={p}
label={label}
provider={p}
thumbnailUrl={getPreviewUrl(250)}
title={t(`imageCropper.share.${p}`)}
/>
),
)}
{["envelope", "facebook", "pinterest", "x", "whatsapp"].map((p) => (
<ShareButton
attribution={attribution}
imageUrl={imageUrl}
key={p}
label={label}
provider={p}
thumbnailUrl={getPreviewUrl(250)}
title={t(`imageCropper.share.${p}`)}
/>
))}
</ButtonGroup>
<Button color="primary" onClick={closeDialog}>
{t("imageCropper.close")}
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, see https://github.com/mui/material-ui/pull/38811 */
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 @@ -23,12 +23,12 @@ const getShareLink = (attribution, imageUrl, label, provider, thumbnailUrl) => {
return `https://www.facebook.com/sharer/sharer.php?title=${text}&u=${imageUrl}`;
case "pinterest":
return `http://pinterest.com/pin/create/bookmarklet/?url=${imageUrl}&description=${text}&media=${thumbnailUrl}`;
case "twitter":
return `https://twitter.com/intent/tweet?text=${
text.length > 60 ? `${text.substring(0, 60)}...` : text
}&url=${imageUrl}&hashtags=iiif`;
case "whatsapp":
return `whatsapp://send?text=${text}: ${imageUrl}`;
case "x":
return `https://x.com/intent/post?text=${
text.length > 60 ? `${text.substring(0, 60)}...` : text
}&url=${imageUrl}&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 @@ -29,8 +29,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",
},
size: "Größe",
},
Expand Down Expand Up @@ -65,8 +65,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",
},
size: "Size",
},
Expand Down

0 comments on commit 9d4bb51

Please sign in to comment.