Skip to content

Commit

Permalink
Added interactive story to Curate component.
Browse files Browse the repository at this point in the history
  • Loading branch information
patcon committed Oct 10, 2024
1 parent c789db9 commit 9903665
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions stories/client-participation/curate.stories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useState } from 'react'
import { action } from '@storybook/addon-actions'
import * as globals from '../../codebases/compdem/client-participation/vis2/components/globals'
import Strings from '../../codebases/compdem/client-participation/js/strings/en_us'
Expand All @@ -12,10 +12,26 @@ export default {
component: Curate
}

const Template = (args) => <Curate {...args} />
const Template = (args) => {
const [selectedTidCuration, setSelectedTidCuration] = useState(globals.tidCuration.majority)
const handleCurateButtonClick = (tidCuration) => {
action("Clicked")(tidCuration)
setSelectedTidCuration(tidCuration)
}
return <Curate {...{selectedTidCuration, handleCurateButtonClick}} {...args} />
}

export const Interactive = Template.bind({})
Interactive.args = {
Strings: {
majorityOpinion: Strings.majorityOpinion,
group_123: Strings.group_123
},
math: mathResults,
}

export const Default = Template.bind({})
Default.args = {
export const Unselected = Template.bind({})
Unselected.args = {
selectedTidCuration: null,
Strings: {
majorityOpinion: Strings.majorityOpinion,
Expand All @@ -27,12 +43,12 @@ Default.args = {

export const MajoritySelected = Template.bind({})
MajoritySelected.args = {
...Default.args,
...Unselected.args,
selectedTidCuration: globals.tidCuration.majority
}

export const GroupSelected = Template.bind({})
GroupSelected.args = {
...Default.args,
...Unselected.args,
selectedTidCuration: 1
}

0 comments on commit 9903665

Please sign in to comment.