-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from poap-xyz/release/v1.13.12
Release v1.13.12
- Loading branch information
Showing
7 changed files
with
196 additions
and
143 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
14 changes: 7 additions & 7 deletions
14
src/components/EventCount.js → src/components/EventPower.js
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,24 +1,24 @@ | ||
import PropTypes from 'prop-types' | ||
import { DropProps } from 'models/drop' | ||
import TokenImage from 'components/TokenImage' | ||
import 'styles/event-count.css' | ||
import 'styles/event-power.css' | ||
|
||
/** | ||
* @param {PropTypes.InferProps<EventCount.propTypes>} props | ||
* @param {PropTypes.InferProps<EventPower.propTypes>} props | ||
*/ | ||
function EventCount({ event, count, size = 64 }) { | ||
function EventPower({ event, count, size = 64 }) { | ||
return ( | ||
<div className="event-count"> | ||
<div className="event-power"> | ||
<TokenImage event={event} size={size} /> | ||
<span className="count">{count}</span> | ||
<span className="power">{count}</span> | ||
</div> | ||
) | ||
} | ||
|
||
EventCount.propTypes = { | ||
EventPower.propTypes = { | ||
event: PropTypes.shape(DropProps).isRequired, | ||
count: PropTypes.number.isRequired, | ||
size: PropTypes.number, | ||
} | ||
|
||
export default EventCount | ||
export default EventPower |
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,81 @@ | ||
import PropTypes from 'prop-types' | ||
import { Link } from 'react-router-dom' | ||
import { clsx } from 'clsx' | ||
import { DropProps } from 'models/drop' | ||
import TokenImage from 'components/TokenImage' | ||
import EventPower from 'components/EventPower' | ||
import 'styles/events-powers.css' | ||
|
||
/** | ||
* @param {PropTypes.InferProps<EventsPowers.propTypes>} props | ||
*/ | ||
function EventsPowers({ | ||
showAll = false, | ||
perfectPower, | ||
selectedEventIds, | ||
onSelect, | ||
events, | ||
powers, | ||
size = 64, | ||
children, | ||
}) { | ||
return ( | ||
<div className={clsx('events-powers', showAll && 'show-all')}> | ||
{powers.map(({ eventId, power }) => ( | ||
<div | ||
key={eventId} | ||
className={clsx('event-power-card', { | ||
selected: selectedEventIds.includes(eventId), | ||
perfect: perfectPower === power, | ||
})} | ||
title={events[eventId].name} | ||
> | ||
<button | ||
className="event-select-button" | ||
onClick={() => onSelect(eventId)} | ||
style={{ | ||
width: `${size}px`, | ||
height: `${size}px`, | ||
}} | ||
> | ||
{perfectPower === power | ||
? <TokenImage event={events[eventId]} size={size} /> | ||
: <EventPower | ||
event={events[eventId]} | ||
count={power} | ||
size={size} | ||
/> | ||
} | ||
</button> | ||
<Link | ||
to={`/event/${eventId}`} | ||
className="event-id" | ||
> | ||
#{eventId} | ||
</Link> | ||
</div> | ||
))} | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
EventsPowers.propTypes = { | ||
showAll: PropTypes.bool, | ||
perfectPower: PropTypes.number, | ||
selectedEventIds: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired, | ||
onSelect: PropTypes.func.isRequired, | ||
events: PropTypes.objectOf( | ||
PropTypes.shape(DropProps).isRequired | ||
).isRequired, | ||
powers: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
eventId: PropTypes.number.isRequired, | ||
power: PropTypes.number.isRequired, | ||
}).isRequired | ||
).isRequired, | ||
size: PropTypes.number, | ||
children: PropTypes.node, | ||
} | ||
|
||
export default EventsPowers |
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
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,39 @@ | ||
.events-powers .event-power-card { | ||
display: inline-block; | ||
border: .1rem solid transparent; | ||
border-radius: 12px; | ||
margin: .2rem; | ||
overflow-wrap: break-word; | ||
width: 72px; | ||
} | ||
|
||
.events-powers.show-all .event-power-card.perfect { | ||
background-color: #eee; | ||
border-color: #cdcdcd; | ||
} | ||
|
||
.events-powers .event-power-card.selected { | ||
background-color: #7d73e2 !important; | ||
border-color: #473e6b !important; | ||
} | ||
|
||
.events-powers .event-power-card .event-select-button { | ||
background: transparent; | ||
border-width: 0; | ||
cursor: pointer; | ||
display: inline-block; | ||
margin: 4px; | ||
outline: none; | ||
} | ||
|
||
.events-powers .event-power-card .event-id { | ||
text-align: center; | ||
display: block; | ||
cursor: pointer; | ||
font-size: 80%; | ||
margin: 1px; | ||
} | ||
|
||
.events-powers .event-power-card.selected .event-id { | ||
color: white; | ||
} |
Oops, something went wrong.