Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo info not rendering #234 #238

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/components/dem-info.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { createUseStyles } from 'react-jss'
export default function DemInfo(props) {
const { state, dob, party, className, ...otherProps } = props
const classes = useStylesFromThemeFunction()
if (!(state && dob && party)) return null // if no data, render not
if (!(state || dob || party)) return null // if no data, render not

const userState = state || ''
const userAge = dob ? calculateAge(dob) : ''

const userPoliticalParty = party || ''

let contentText = ''
Expand Down
8 changes: 4 additions & 4 deletions stories/dem-info.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {

export const PrimaryAllFieldsIncluded = {
args: {
dob: '1990-10-20T00:00:00.000Z',
dob: new Date('1990-10-20T00:00:00.000Z').toISOString(),
state: 'NY',
party: 'Independent',
},
Expand All @@ -18,7 +18,7 @@ export const UserNotFound = { args: {} }

export const AgeAndStateOnly = {
args: {
dob: '1990-10-20T00:00:00.000Z',
dob: new Date('1990-10-20T00:00:00.000Z').toISOString(),
state: 'NY',
},
}
Expand All @@ -32,7 +32,7 @@ export const StateAndPartyOnly = {

export const AgeAndPartyOnly = {
args: {
dob: '1990-10-20T00:00:00.000Z',
dob: new Date('1990-10-20T00:00:00.000Z').toISOString(),
party: 'Independent',
},
}
Expand All @@ -45,7 +45,7 @@ export const PartyOnly = {

export const AgeOnly = {
args: {
dob: '1990-10-20T00:00:00.000Z',
dob: new Date('1990-10-20T00:00:00.000Z').toISOString(),
},
}

Expand Down