mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-26 17:26:22 +00:00
39 lines
1,000 B
TypeScript
39 lines
1,000 B
TypeScript
/*
|
|
* Vencord, a Discord client mod
|
|
* Copyright (c) 2024 Vendicated and contributors
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
import "./quickActions.css";
|
|
|
|
import { classNameFactory } from "@api/Styles";
|
|
import { Card } from "@webpack/common";
|
|
import type { ComponentType, PropsWithChildren, ReactNode } from "react";
|
|
|
|
const cl = classNameFactory("vc-settings-quickActions-");
|
|
|
|
export interface QuickActionProps {
|
|
Icon: ComponentType<{ className?: string; }>;
|
|
text: ReactNode;
|
|
action?: () => void;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export function QuickAction(props: QuickActionProps) {
|
|
const { Icon, action, text, disabled } = props;
|
|
|
|
return (
|
|
<button className={cl("pill")} onClick={action} disabled={disabled}>
|
|
<Icon className={cl("img")} />
|
|
{text}
|
|
</button>
|
|
);
|
|
}
|
|
|
|
export function QuickActionCard(props: PropsWithChildren) {
|
|
return (
|
|
<Card className={cl("card")}>
|
|
{props.children}
|
|
</Card>
|
|
);
|
|
}
|