Skip to content

Commit

Permalink
adding default icons
Browse files Browse the repository at this point in the history
  • Loading branch information
JollyGrin committed Apr 1, 2024
1 parent 0981d1a commit 0d9f3dd
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/BoardCanvas/Tokens/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Image = ({ imageUrl }: { imageUrl: string }) =>
`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 24 24">
`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 24 24">
<image href="${imageUrl}" height='100%' >
</svg>`;

Expand Down
21 changes: 21 additions & 0 deletions components/BoardCanvas/defaultTokenImages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Default Tokens for the board!
*
* To add to this list, add the file to /public/tokens/...
*
* Then add the filename to IMAGES
* */

const IMAGES = [
"Alien.svg",
"BrickWall.svg",
"CloudFog.svg",
"Fire.svg",
"Flag.svg",
"HandShield.svg",
"ShieldHalf.svg",
"Totem.svg",
"Trap.svg",
];

export const DEFAULT_TOKEN_IMAGES = IMAGES.map((img) => `/tokens/${img}`);
13 changes: 8 additions & 5 deletions components/Positions/position.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { CirclePicker } from "react-color";
import { PositionType } from "./position.type";
import { useRouter } from "next/router";
import { toast } from "react-hot-toast";
import { DEFAULT_TOKEN_IMAGES } from "../BoardCanvas/defaultTokenImages";

export const PositionModal: FC<{
isOpen: boolean;
Expand Down Expand Up @@ -216,14 +217,14 @@ const TokenPreview = ({

<Menu>
<MenuButton as={Button}>Tokens</MenuButton>
<MenuList>
<MenuList maxH="400px" overflowY="auto">
<FormLabel fontSize="0.75rem" pl="0.75rem" color="black">
Add Token (via url)
</FormLabel>
{imageUrl && <Image src={imageUrl} w="3rem" />}
<HStack mb="0.5rem" px="0.5rem">
<Input
placeholder="image url"
placeholder="image url (.svg, .png, .jpeg)"
value={imageUrl}
onChange={(e) => setImageUrl(e.target.value)}
/>
Expand All @@ -235,9 +236,11 @@ const TokenPreview = ({
<FormLabel fontSize="0.75rem" pl="0.75rem" color="black">
Default Tokens
</FormLabel>
<MenuItem onClick={() => setImage("https://picsum.photos/200")}>
<Image src="https://picsum.photos/200" w="100px" />
</MenuItem>
{DEFAULT_TOKEN_IMAGES.map((img) => (
<MenuItem key={img} onClick={() => setImage(img)}>
<Image src={img} fill="red" color="red" w="100px" />
</MenuItem>
))}
</MenuList>
</Menu>
</Grid>
Expand Down
5 changes: 5 additions & 0 deletions public/tokens/Alien.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/BrickWall.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/CloudFog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/Fire.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/Flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/HandShield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/ShieldHalf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/Totem.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/tokens/Trap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0d9f3dd

Please sign in to comment.