[TS] Type Summary component properly
This commit is contained in:
parent
67b501b974
commit
9989dfbf0d
2 changed files with 13 additions and 7 deletions
12
src/def.d.ts
vendored
12
src/def.d.ts
vendored
|
@ -5,6 +5,15 @@ import _Clipboard from "@react-native-clipboard/clipboard";
|
||||||
|
|
||||||
type MetroModules = { [id: number]: any };
|
type MetroModules = { [id: number]: any };
|
||||||
|
|
||||||
|
// Component types
|
||||||
|
// TODO: Make these not be here?
|
||||||
|
interface SummaryProps {
|
||||||
|
label: string;
|
||||||
|
icon?: string;
|
||||||
|
noPadding?: boolean;
|
||||||
|
children: JSX.Element | JSX.Element[];
|
||||||
|
}
|
||||||
|
|
||||||
// Helper types for API functions
|
// Helper types for API functions
|
||||||
type PropIntellisense<P extends string | symbol> = Record<P, any> & Record<PropertyKey, any>;
|
type PropIntellisense<P extends string | symbol> = Record<P, any> & Record<PropertyKey, any>;
|
||||||
type PropsFinder = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>;
|
type PropsFinder = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>;
|
||||||
|
@ -312,9 +321,12 @@ interface VendettaObject {
|
||||||
}
|
}
|
||||||
ui: {
|
ui: {
|
||||||
components: {
|
components: {
|
||||||
|
// Discord
|
||||||
Forms: PropIntellisense<"Form" | "FormSection">;
|
Forms: PropIntellisense<"Form" | "FormSection">;
|
||||||
General: PropIntellisense<"Button" | "Text" | "View">;
|
General: PropIntellisense<"Button" | "Text" | "View">;
|
||||||
Search: _React.ComponentType;
|
Search: _React.ComponentType;
|
||||||
|
// Vendetta
|
||||||
|
Summary: (props: SummaryProps) => JSX.Element;
|
||||||
}
|
}
|
||||||
toasts: {
|
toasts: {
|
||||||
showToast: (content: string, asset: number) => void;
|
showToast: (content: string, asset: number) => void;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { SummaryProps } from "@types";
|
||||||
import { getAssetIDByName } from "@ui/assets";
|
import { getAssetIDByName } from "@ui/assets";
|
||||||
import { ReactNative as RN } from "@metro/common";
|
import { ReactNative as RN } from "@metro/common";
|
||||||
import { Forms } from "@ui/components";
|
import { Forms } from "@ui/components";
|
||||||
|
@ -5,13 +6,6 @@ import { Forms } from "@ui/components";
|
||||||
// TODO: Animated would be awesome
|
// TODO: Animated would be awesome
|
||||||
// TODO: Destructuring Forms doesn't work here. Why?
|
// TODO: Destructuring Forms doesn't work here. Why?
|
||||||
|
|
||||||
interface SummaryProps {
|
|
||||||
label: string;
|
|
||||||
icon?: string;
|
|
||||||
noPadding?: boolean;
|
|
||||||
children: JSX.Element | JSX.Element[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Summary({ label, icon, noPadding = false, children }: SummaryProps) {
|
export default function Summary({ label, icon, noPadding = false, children }: SummaryProps) {
|
||||||
const [hidden, setHidden] = React.useState(true);
|
const [hidden, setHidden] = React.useState(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue