Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
feat: disable total amount
Browse files Browse the repository at this point in the history
  • Loading branch information
CanRau committed Jan 3, 2020
1 parent d6833be commit d5e5434
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
80 changes: 40 additions & 40 deletions src/templates/ContributorsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import PropTypes from 'prop-types'
import { graphql, Link } from 'gatsby'
import styled from '@emotion/styled'
import { css } from '@emotion/core'
import { Spring, animated, config } from 'react-spring/renderprops'
// import { Spring, animated, config } from 'react-spring/renderprops'
import MainLayout from '@components/MainLayout'
import { colors, media } from '@src/theme'

const TotalDonated = styled.h4`
text-align: center;
`
// const TotalDonated = styled.h4`
// text-align: center;
// `
const ContributorList = styled.div`
margin-top: 4rem;
${media.greaterThan(`small`)} {
Expand Down Expand Up @@ -56,36 +56,36 @@ const ContributorLink = styled.a`
transform: scale(1.03);
}
`
const TotalAmount = ({ amount }) => (
<Spring
native
from={{ total: 0 }}
to={{ total: amount }}
config={{
...config.molasses,
tension: 600,
precision: 1,
delay: 50,
}}
>
{({ total }) => (
<animated.span
css={css`
width: ${(`${amount}`.length || 1) + 1}rem;
display: inline-block;
text-align: right;
font-weight: 700;
`}
>
{total}
{/* {total.interpolate(n => n.toFixed(0))} */}
</animated.span>
)}
</Spring>
)
TotalAmount.propTypes = {
amount: PropTypes.number,
}
// const TotalAmount = ({ amount }) => (
// <Spring
// native
// from={{ total: 0 }}
// to={{ total: amount }}
// config={{
// ...config.molasses,
// tension: 600,
// precision: 1,
// delay: 50,
// }}
// >
// {({ total }) => (
// <animated.span
// css={css`
// width: ${(`${amount}`.length || 1) + 1}rem;
// display: inline-block;
// text-align: right;
// font-weight: 700;
// `}
// >
// {total}
// {/* {total.interpolate(n => n.toFixed(0))} */}
// </animated.span>
// )}
// </Spring>
// )
// TotalAmount.propTypes = {
// amount: PropTypes.number,
// }

const TakeAction = ({ label, link }) => (
<h1>
Expand Down Expand Up @@ -123,9 +123,9 @@ class ContributorsPage extends React.Component {
state = {
items: [],
highlighted: null,
total: this.props.data.contributors.edges
.reduce((acc, val) => acc + val.node.item.amount, 0)
.toFixed(0),
// total: this.props.data.contributors.edges
// .reduce((acc, val) => acc + val.node.item.amount, 0)
// .toFixed(0),
}

componentDidMount = () => {
Expand All @@ -149,12 +149,12 @@ class ContributorsPage extends React.Component {
return (
<MainLayout {...this.props}>
{/* <h3>animate the total amount? maybe animate the list?</h3> */}
<TotalDonated>
{/* <TotalDonated>
<TotalAmount amount={this.state.total} />
<span>
{`${page.frontmatter.squareMeterLabel} ${page.frontmatter.donatedSoFarLabel}`}
</span>
</TotalDonated>
</TotalDonated> */}

<TakeAction
label={page.frontmatter.takeActionLabel}
Expand Down Expand Up @@ -258,7 +258,7 @@ export const query = graphql`
thanksLabel
forLabel
squareMeterLabel
donatedSoFarLabel
# donatedSoFarLabel
takeActionLabel
takeActionLink
Expand Down
4 changes: 2 additions & 2 deletions src/templates/DonatePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ const DonatePage = props => {
/>
))}
</div>
<div
{/* <div
sx={{ marginTop: `1rem` }}
dangerouslySetInnerHTML={{
__html: page.frontmatter.contributorInfo.replace(
`[[amount]]`,
calcTotalAmount(contributions)
),
}}
/>
/> */}
</div>
</div>

Expand Down

0 comments on commit d5e5434

Please sign in to comment.