Skip to content

Commit

Permalink
Merge pull request #5 from Tharki-God/oki
Browse files Browse the repository at this point in the history
Oki
  • Loading branch information
Wolfkid200444 authored Dec 8, 2023
2 parents ed8ee29 + b05682e commit 5151de0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 36 deletions.
19 changes: 8 additions & 11 deletions src/ui/components/DecorationGridNone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ type DecorationGridNoneProps = HTMLProps<HTMLDivElement> & {
};

export default function DecorationGridNone(props: DecorationGridNoneProps) {
return <DecorationGridItem
{...props}
>
<NoEntrySignIcon />
<Text.Normal
variant="text-xs/normal"
color="header-primary"
>
{i18n.Messages.NONE}
</Text.Normal>
</DecorationGridItem >;
return (
<DecorationGridItem {...props}>
<NoEntrySignIcon />
<Text.Normal variant="text-xs/normal" color="header-primary">
{i18n.Messages.NONE}
</Text.Normal>
</DecorationGridItem>
);
}
25 changes: 15 additions & 10 deletions src/ui/components/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ export interface GridProps<ItemT> {
items: Array<ItemT>;
}

export default function Grid<ItemT,>({ renderItem, getItemKey, itemKeyPrefix: ikp, items }: GridProps<ItemT>) {
return <div className={cl("sectioned-grid-list-grid")}>
{items.map(item =>
<React.Fragment
key={`${ikp ? `${ikp}-` : ""}${getItemKey(item)}`}
>
{renderItem(item)}
</React.Fragment>
)}
</div>;
export default function Grid<ItemT>({
renderItem,
getItemKey,
itemKeyPrefix: ikp,
items,
}: GridProps<ItemT>) {
return (
<div className={cl("sectioned-grid-list-grid")}>
{items?.map((item) => (
<React.Fragment key={`${ikp ? `${ikp}-` : ""}${getItemKey(item)}`}>
{renderItem(item)}
</React.Fragment>
))}
</div>
);
}
35 changes: 20 additions & 15 deletions src/ui/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
import { common, webpack } from "replugged";
import type { ComponentType, HTMLProps, PropsWithChildren } from "react";
import { AvatarDecoration } from "../..";
import Grid from "./Grid";
const { React } = common;

const { React } = common
type DecorationGridItemComponent = ComponentType<
PropsWithChildren<HTMLProps<HTMLDivElement>> & {
onSelect: () => void;
isSelected: boolean;
}
>;

type DecorationGridItemComponent = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement>> & {
onSelect: () => void,
isSelected: boolean,
}>;
type DecorationGridDecorationComponent = React.ComponentType<
HTMLProps<HTMLDivElement> & {
avatarDecoration: AvatarDecoration;
onSelect: () => void;
isSelected: boolean;
}
>;

type DecorationGridDecorationComponent = React.ComponentType<HTMLProps<HTMLDivElement> & {
avatarDecoration: AvatarDecoration;
onSelect: () => void,
isSelected: boolean,
}>;
export const AvatarDecorationModalPreview = React.memo(
webpack.getBySource("AvatarDecorationModalPreview"),
);

export const AvatarDecorationModalPreview = React.memo(webpack.getBySource("AvatarDecorationModalPreview"));

export let DecorationGridItem: DecorationGridItemComponent;
export const setDecorationGridItem = v => DecorationGridItem = v;
export const DecorationGridItem: DecorationGridItemComponent = Grid;

export let DecorationGridDecoration: DecorationGridDecorationComponent;
export const setDecorationGridDecoration = v => DecorationGridDecoration = v;
export const setDecorationGridDecoration = (v) => (DecorationGridDecoration = v);

0 comments on commit 5151de0

Please sign in to comment.