-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add card tooltips based on react-hs-components
Use hotfixed file-loader for now, until webpack-contrib/file-loader#183 is released.
- Loading branch information
Showing
13 changed files
with
161 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
declare module "*.png" { | ||
const content: string; | ||
export default content; | ||
} | ||
|
||
declare const APPLICATION_VERSION: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { makeHOC } from "./hocs"; | ||
import * as PropTypes from "prop-types"; | ||
|
||
export interface PortalProps { | ||
portal: HTMLDivElement; | ||
} | ||
|
||
export const withPortal = makeHOC<PortalProps>({ | ||
portal: PropTypes.object, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as React from "react"; | ||
import { Card as ComponentCard } from "react-hs-components"; | ||
import { CardsProps, withCards } from "../utils/cards"; | ||
import { getPlaceholder } from "./placeholders"; | ||
|
||
interface CardProps extends React.ClassAttributes<Card> { | ||
dbfId: number; | ||
x?: number; | ||
y?: number; | ||
} | ||
|
||
class Card extends React.Component<CardProps & CardsProps, {}> { | ||
render() { | ||
const card = this.props.cards.getByDbfId(this.props.dbfId); | ||
if (!card || !card.id) { | ||
return <div>Invalid card</div>; | ||
} | ||
return ( | ||
<ComponentCard | ||
id={card.id} | ||
style={{ | ||
position: "absolute", | ||
height: "40vh", | ||
top: this.props.y ? `calc(${this.props.y}px - 7.5vh - 20vh)` : 0, | ||
left: this.props.x || 0, | ||
pointerEvents: "none", | ||
}} | ||
resolution={512} | ||
placeholder={getPlaceholder(card.type || "")} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default withCards(Card); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import MinionPlaceholder from "./minion.png"; | ||
import SpellPlaceholder from "./spell.png"; | ||
import WeaponPlaceholder from "./weapon.png"; | ||
import HeroPlaceholder from "./hero.png"; | ||
|
||
const getPlaceholder = (type: string): string => { | ||
switch (type) { | ||
case "SPELL": | ||
return SpellPlaceholder; | ||
case "WEAPON": | ||
return WeaponPlaceholder; | ||
case "HERO": | ||
return HeroPlaceholder; | ||
default: | ||
case "MINION": | ||
return MinionPlaceholder; | ||
} | ||
}; | ||
|
||
export { | ||
getPlaceholder, | ||
MinionPlaceholder, | ||
SpellPlaceholder, | ||
HeroPlaceholder, | ||
WeaponPlaceholder, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters