Skip to content

Commit

Permalink
Move SVG icon to dedicated file
Browse files Browse the repository at this point in the history
  • Loading branch information
bduhbya committed Jan 15, 2024
1 parent 1cc7dd8 commit 7c12c59
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
10 changes: 10 additions & 0 deletions replit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ pkgs }: {
deps = [
pkgs.yarn
pkgs.esbuild
pkgs.nodejs-18_x

pkgs.nodePackages.typescript
pkgs.nodePackages.typescript-language-server
];
}
19 changes: 2 additions & 17 deletions rpg-buddy/src/app/components/CombatTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useState } from "react";
import { Character } from "../lib/definitions";
import InitiativeInputDialog from "./InitiativeInputDialog";
import {CheckmarkIconPositive} from "../lib/SVGIcons";

const CombatTracker: React.FC = () => {
const [combatCharacters, setCombatCharacters] = useState<Character[]>([]);
Expand All @@ -12,22 +13,6 @@ const CombatTracker: React.FC = () => {
null,
);

// SVG checkmark icon
const CheckmarkIcon: React.FC = () => {
return <svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="green"
className="h-4 w-4"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M5 13l4 4L19 7" />
</svg>;
};

const handleToggleSortDescending = () => {
// Toggle the sort order
Expand Down Expand Up @@ -183,7 +168,7 @@ const CombatTracker: React.FC = () => {
// className={index === currentCharacterIndex ? "bg-gray-200" : ""}
>
<td className="border p-2">
{index === currentCharacterIndex && <CheckmarkIcon />}
{index === currentCharacterIndex && CheckmarkIconPositive />}
</td>
<td className="border p-2">{character.name}</td>
<td className="border p-2">{character.initiative}</td>
Expand Down
16 changes: 16 additions & 0 deletions rpg-buddy/src/app/lib/SVGIcons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SVG checkmark icon
export const CheckmarkIconPositive: React.FC = () => {
return <svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="green"
className="h-4 w-4"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M5 13l4 4L19 7" />
</svg>;
};

0 comments on commit 7c12c59

Please sign in to comment.