mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
media page button download attribute
This commit is contained in:
1 parent
69fe289180
commit
f9907aa81c
2 files changed
+16
-2
No files matched your search
@@ -18,6 +18,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
tooltip?: string;
|
||||
full?: boolean;
|
||||
iconFlip?: boolean;
|
||||
download?: boolean | string;
|
||||
}
|
||||
|
||||
export default function Button({
|
||||
@@ -32,6 +33,7 @@ export default function Button({
|
||||
tooltip,
|
||||
full = false,
|
||||
iconFlip = false,
|
||||
download,
|
||||
...rest
|
||||
}: ButtonProps) {
|
||||
let iconMarginClass = !square && label ? (iconFlip ? "ms-2" : "me-2") : "";
|
||||
@@ -68,7 +70,15 @@ export default function Button({
|
||||
{ButtonContent}
|
||||
</Link>
|
||||
) : href ? (
|
||||
<a href={href} target={target} rel="noopener noreferrer" {...commonProps}>
|
||||
<a
|
||||
href={href}
|
||||
target={target}
|
||||
rel="noopener noreferrer"
|
||||
download={
|
||||
download ? (typeof download === "string" ? download : true) : undefined
|
||||
}
|
||||
{...commonProps}
|
||||
>
|
||||
{ButtonContent}
|
||||
</a>
|
||||
) : (
|
||||
|
||||
@@ -27,6 +27,7 @@ import { Gravatar } from "@storyteller/components/src/elements/Gravatar";
|
||||
import useTimeAgo from "hooks/useTimeAgo";
|
||||
import { CommentComponent } from "v2/view/_common/comments/CommentComponent";
|
||||
import { MediaFileType } from "@storyteller/components/src/api/_common/enums/MediaFileType";
|
||||
import { BucketConfig } from "@storyteller/components/src/api/BucketConfig";
|
||||
|
||||
interface MediaPageProps {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -103,6 +104,8 @@ export default function MediaPage({ sessionWrapper }: MediaPageProps) {
|
||||
}
|
||||
}
|
||||
|
||||
let audioLink = new BucketConfig().getGcsUrl(mediaFile?.public_bucket_path);
|
||||
|
||||
if (isLoading)
|
||||
return (
|
||||
<>
|
||||
@@ -302,8 +305,9 @@ export default function MediaPage({ sessionWrapper }: MediaPageProps) {
|
||||
<Button
|
||||
icon={faArrowDownToLine}
|
||||
label="Download"
|
||||
onClick={() => {}}
|
||||
className="flex-grow-1"
|
||||
href={audioLink}
|
||||
download={true}
|
||||
/>
|
||||
{/* <div className="d-flex gap-2">
|
||||
<Button
|
||||
|
||||
Reference in new issue
Block a user