react-icons/fi#FiMinusCircle JavaScript Examples
The following examples show how to use
react-icons/fi#FiMinusCircle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BoardCard.js From ytx-card-game with MIT License | 4 votes |
BoardCard = (props) => {
const card_names = {
one,
two,
three,
four,
five,
six,
seven,
eight,
nine,
ten,
eleven,
twelve,
tt,
zz
}
let img_name;
if (Object.keys(card_names).includes(props.card_img)) {
img_name = card_names[props.card_img]
}
const { state, dispatch } = useContext(store)
const toggleAttackMode = (cardId) => {
let isAttackMode = cardId == 0 ? false : !state.isAttackMode
dispatch({
type: 'SET_ATTACK_MODE',
payload: {
isAttackMode,
attackingCardId: cardId,
},
})
}
/**
* @dev Burns the selected card on hand and refund a part of the cost as energy to the player
* @param {String} cardID
*/
const burnCardOnHand = (cardID) => {
state.socket.emit('burn-card', {
currentGameID: state.game.gameId,
cardID,
burnType: 'hand',
})
}
const isGamePaused = () => state.game && state.game.gamePaused
let isAllyCard = state.playerNumber === props.playerNumberOwner
// If the card is ally, display the attack button or invoke, else don't display actions
let buttonToDisplay
if (props.isInvoked && isAllyCard) {
buttonToDisplay = (
<CardButton
disabled={
!props.canAttack ||
state.isOtherPlayerTurn ||
isGamePaused()
}
onClick={() => {
toggleAttackMode(props.id)
}}
>
Attack
</CardButton>
)
} else if (isAllyCard) {
buttonToDisplay = (
<div>
<CardButton
style={{
backgroundColor: '#ffad04',
}}
disabled={state.isOtherPlayerTurn || isGamePaused()}
onClick={() => {
burnCardOnHand(props.id)
}}
>
Burn
</CardButton>
</div>
)
}
const renderSwitch = (param) => {
switch (param) {
case 'wind':
return <FiWind />;
case 'fire':
return <ImFire />;
case 'water':
return <GiDrop />;
case 'death':
return <GiDeathSkull />;
case 'life':
return <FaHeart />;
case 'neutral':
return <FiMinusCircle />;
default:
return param;
}
}
return (
<StyledCard data-id={props.dataId} card_name={img_name}>
<div>{props.cost}<FaBolt size={18} /> </div>
<div><span>{props.life}</span><FaHeart color={'rgba(255, 255, 255, 0.3)'} size={26} /> </div>
<div><span>{props.attack}</span><GiBowieKnife color={'rgba(255, 255, 255, 0.3)'} size={26} /> </div>
<div className={'card ' + props.type}>{renderSwitch(props.type)}</div>
<div className="spacer"></div>
{buttonToDisplay}
</StyledCard>
)
}