Skip to content

Commit

Permalink
PP-13510: transition card movement and reduce flash
Browse files Browse the repository at this point in the history
  • Loading branch information
sfount authored and katstevens committed Jan 16, 2025
1 parent 09815d5 commit d9b4d2c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
18 changes: 16 additions & 2 deletions browser/src/dashboard/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,20 @@ interface EventCardProps {
showAllEvents: boolean
}

export class EventCard extends React.Component<EventCardProps, {}> {
export class EventCard extends React.Component<EventCardProps, { shouldShow: boolean, showTimer?: NodeJS.Timer }> {
state = {
shouldShow: false,
}

componentDidMount() {
setTimeout(() => this.setState({ shouldShow: true }))
}
componentWillUnmount() {
// if(this.state.showTimer) {
// clearTimeout(this.state.showTimer)
// }
}

render() {
const profile = this.props.showAllEvents ? (profileMap[this.props.event.event_type] || DefaultProfile) : DefaultProfile
const paymentTypeIcon = paymentTypeMap[this.props.event.card_brand] || UnknownIcon
Expand Down Expand Up @@ -104,8 +117,9 @@ export class EventCard extends React.Component<EventCardProps, {}> {
if (this.props.event.is_recent) {
recentTag = <div style={{ textAlign: 'left', marginBottom: '8px', marginLeft: '8px', marginTop: '16px' }}><span className="govuk-tag govuk-tag--blue">new service</span></div>
}
const showClass = this.state.shouldShow ? 'show' : ''
return (
<div>
<div className={ "slide-card slide-fade " + showClass }>
<OpacitySpring>
{ recentTag }
<div className="event-card govuk-!-margin-bottom-2" style={{ backgroundColor: profile.backgroundColour }}>
Expand Down
20 changes: 20 additions & 0 deletions src/assets/payuk-toolbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,23 @@
transform: rotate(360deg);
}
}

.slide-card {
height: 0px;
// line-height: 75px;
transform: translateY(-100px);
}

.slide-card.slide-fade {
transition: all 0.7s ease;
opacity: 0;
}

.slide-card.slide-fade.show {
opacity: 1;
height: 75px;
transform: translateY(0px);

// temporary - needs to be worked out how this interacts with event-card etc.
margin-bottom: 10px;
}

0 comments on commit d9b4d2c

Please sign in to comment.