Skip to content

Commit

Permalink
move ItemCard into own file
Browse files Browse the repository at this point in the history
  • Loading branch information
signed committed Jan 12, 2023
1 parent 0d111a1 commit 47eb2df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
12 changes: 12 additions & 0 deletions src/cards/ItemCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ItemProps } from 'cards/CardRenderProps';
import * as React from 'react';

export const ItemCard = (props: ItemProps) => {
const style = {
display: 'inline-block',
borderRadius: '20px'
} as React.CSSProperties;

const src = `/~https://github.com/any2cards/gloomhaven/raw/master/images/${props.path}`;
return <img key={props.id} style={style} src={src} alt={props.name}/>;
};
14 changes: 2 additions & 12 deletions src/cards/PersonalGoalCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ItemProps } from 'cards/CardRenderProps';
import * as React from "react";
import { NoState } from "../lang/react";
import * as React from 'react';
import { NoState } from '../lang/react';

interface PersonalGoalCardProps {
cardId: number;
Expand All @@ -18,12 +17,3 @@ export class PersonalGoalCard extends React.Component<PersonalGoalCardProps, NoS
}
}

export const ItemCard = (props: ItemProps) => {
const style = {
display: "inline-block",
borderRadius: '20px'
} as React.CSSProperties;

const src = `/~https://github.com/any2cards/gloomhaven/raw/master/images/${props.path}`
return <img key={props.id} style={style} src={src} alt={props.name}/>
}
3 changes: 2 additions & 1 deletion src/cards/cards.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ItemCard } from 'cards/ItemCard';
import { gloomhavenItems } from 'cards/items-data';
import { ItemCard, PersonalGoalCard } from 'cards/PersonalGoalCard';
import { PersonalGoalCard } from 'cards/PersonalGoalCard';
import * as React from 'react';
import { CardRenderProps, isItemProps, isPersonalGoalProps, isRandomItemDesignProps, isRandomSideScenarioProps, ItemProps } from './CardRenderProps';

Expand Down

0 comments on commit 47eb2df

Please sign in to comment.