-
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.
improve: make vote table columns narrower (#79)
* add mocks to vote page story Signed-off-by: ryanwolhuter <[email protected]> * add long titles to vote mocks Signed-off-by: ryanwolhuter <[email protected]> * use auto table layout Signed-off-by: ryanwolhuter <[email protected]> * remove format vote title Signed-off-by: ryanwolhuter <[email protected]> * add nowrap to button Signed-off-by: ryanwolhuter <[email protected]> * use vw based padding Signed-off-by: ryanwolhuter <[email protected]> * use css to truncate vote title Signed-off-by: ryanwolhuter <[email protected]> * use clamped values for page padding Signed-off-by: ryanwolhuter <[email protected]> Signed-off-by: ryanwolhuter <[email protected]>
- Loading branch information
1 parent
82735fb
commit 91ca52e
Showing
10 changed files
with
158 additions
and
39 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
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
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
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 |
---|---|---|
@@ -1,11 +1,99 @@ | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
import { Meta, Story } from "@storybook/react"; | ||
import { | ||
defaultVotesContextState, | ||
defaultVoteTimingContextState, | ||
VotesContext, | ||
VoteTimingContext, | ||
} from "contexts"; | ||
import VotePage from "pages"; | ||
import { | ||
voteCommitted, | ||
voteCommittedButNotRevealed, | ||
voteRevealed, | ||
voteWithCorrectVoteWithoutUserVote, | ||
voteWithCorrectVoteWithUserVote, | ||
voteWithoutUserVote, | ||
} from "stories/mocks/votes"; | ||
import { ActivityStatusT, VoteT } from "types"; | ||
|
||
interface StoryProps { | ||
phase: "commit" | "reveal"; | ||
activeVotes: VoteT[]; | ||
upcomingVotes: VoteT[]; | ||
pastVotes: VoteT[]; | ||
activityStatus: ActivityStatusT; | ||
} | ||
|
||
export default { | ||
title: "Pages/Vote Page/VotePage", | ||
component: VotePage, | ||
} as ComponentMeta<typeof VotePage>; | ||
} as Meta<StoryProps>; | ||
|
||
const Template: Story<StoryProps> = (args) => { | ||
const mockVoteTimingContextState = { | ||
...defaultVoteTimingContextState, | ||
phase: args.phase ?? "commit", | ||
roundId: 1, | ||
}; | ||
|
||
const mockVotesContextState = { | ||
...defaultVotesContextState, | ||
getActiveVotes: () => args.activeVotes ?? [], | ||
getUpcomingVotes: () => args.upcomingVotes ?? [], | ||
getPastVotes: () => args.pastVotes ?? [], | ||
getActivityStatus: () => args.activityStatus ?? "past", | ||
}; | ||
|
||
return ( | ||
<VoteTimingContext.Provider value={mockVoteTimingContextState}> | ||
<VotesContext.Provider value={mockVotesContextState}> | ||
<VotePage /> | ||
</VotesContext.Provider> | ||
</VoteTimingContext.Provider> | ||
); | ||
}; | ||
|
||
export const ActiveCommit = Template.bind({}); | ||
ActiveCommit.args = { | ||
activityStatus: "active", | ||
phase: "commit", | ||
activeVotes: [ | ||
voteWithoutUserVote, | ||
voteCommitted, | ||
voteWithoutUserVote, | ||
voteCommitted, | ||
], | ||
}; | ||
|
||
export const ActiveReveal = Template.bind({}); | ||
ActiveReveal.args = { | ||
activityStatus: "active", | ||
phase: "reveal", | ||
activeVotes: [ | ||
voteCommittedButNotRevealed, | ||
voteRevealed, | ||
voteCommittedButNotRevealed, | ||
voteRevealed, | ||
], | ||
}; | ||
|
||
const Template: ComponentStory<typeof VotePage> = () => <VotePage />; | ||
export const Upcoming = Template.bind({}); | ||
Upcoming.args = { | ||
activityStatus: "upcoming", | ||
upcomingVotes: [ | ||
voteWithoutUserVote, | ||
voteWithoutUserVote, | ||
voteWithoutUserVote, | ||
], | ||
}; | ||
|
||
export const Default = Template.bind({}); | ||
export const Past = Template.bind({}); | ||
Past.args = { | ||
activityStatus: "past", | ||
pastVotes: [ | ||
voteWithCorrectVoteWithUserVote, | ||
voteWithCorrectVoteWithoutUserVote, | ||
voteWithCorrectVoteWithUserVote, | ||
voteWithCorrectVoteWithoutUserVote, | ||
], | ||
}; |
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