Skip to content

Commit

Permalink
Merge pull request #1193 from prezly/revert-1192-feature/care-6262-te…
Browse files Browse the repository at this point in the history
…mporarily-disable-the-download-button-in-gallery

[CARE-6365] Fix - Re-enable downloading ZIP file ability
  • Loading branch information
mohammadxali authored Oct 9, 2024
2 parents 6402ec6 + fc17ba3 commit d2a14b2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 34 deletions.
5 changes: 0 additions & 5 deletions modules/Gallery/DownloadLink.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,3 @@
height: 1rem;
margin-left: $spacing-1;
}

.disabled {
opacity: 0.5;
cursor: not-allowed;
}
12 changes: 3 additions & 9 deletions modules/Gallery/DownloadLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { DOWNLOAD, useAnalytics } from '@prezly/analytics-nextjs';
import type { Locale } from '@prezly/theme-kit-nextjs';
import { translations } from '@prezly/theme-kit-nextjs';
import classNames from 'classnames';

import { FormattedMessage } from '@/adapters/client';
import { ButtonLink } from '@/components/Button';
Expand All @@ -14,10 +13,9 @@ import styles from './DownloadLink.module.scss';
interface Props {
localeCode: Locale.Code;
href: string;
disabled: boolean;
}

export function DownloadLink({ localeCode, href, disabled }: Props) {
export function DownloadLink({ localeCode, href }: Props) {
const { track } = useAnalytics();

function handleClick() {
Expand All @@ -26,14 +24,10 @@ export function DownloadLink({ localeCode, href, disabled }: Props) {

return (
<ButtonLink
title={disabled ? 'Temporarily disabled due to system maintenance' : undefined}
variation="primary"
forceRefresh
// eslint-disable-next-line no-script-url
href={disabled ? 'javascript:void(0)' : href}
className={classNames(styles.link, {
[styles.disabled]: disabled,
})}
href={href}
className={styles.link}
onClick={handleClick}
>
<FormattedMessage locale={localeCode} for={translations.actions.download} />
Expand Down
4 changes: 1 addition & 3 deletions modules/Gallery/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export function Gallery({ localeCode, gallery, href, withSharingIcons }: Props)
<PageTitle className={styles.title} title={name} subtitle={description} />

<div className={styles.links}>
{downloadUrl && (
<DownloadLink disabled localeCode={localeCode} href={downloadUrl} />
)}
{downloadUrl && <DownloadLink localeCode={localeCode} href={downloadUrl} />}
{withSharingIcons && <StoryLinks url={href} className={styles.shareLinks} />}
</div>

Expand Down
39 changes: 23 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@prezly/content-renderer-react-js": "0.39.2",
"@prezly/sdk": "21.12.0",
"@prezly/story-content-format": "0.65.1",
"@prezly/theme-kit-nextjs": "9.7.0",
"@prezly/theme-kit-nextjs": "9.7.1",
"@prezly/uploadcare": "2.5.0",
"@prezly/uploadcare-image": "0.3.2",
"@react-hookz/web": "14.7.1",
Expand Down

0 comments on commit d2a14b2

Please sign in to comment.