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

Bill Detail Testimony View #915

Closed
wants to merge 0 commits into from

Conversation

MarkTrepanier
Copy link
Collaborator

#885
Bill Testimony List that requires new UI, Hook adjustment and use roles support(Organization)

So far, I've translated the design for the tabs from the Figma mock-up. Instead of using built-in tabs that did not have a slider feature or importing another library, I made use of React's Ref hooks to position and size a slider.

@vercel
Copy link

vercel bot commented Feb 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
maple-dev ⬜️ Ignored (Inspect) Mar 20, 2023 at 5:55PM (UTC)
maple-prod ⬜️ Ignored (Inspect) Mar 20, 2023 at 5:55PM (UTC)

@alexjball alexjball self-requested a review February 22, 2023 02:05
@alexjball alexjball self-assigned this Feb 22, 2023
<div ref={el => (tabRefs.current[index] = el)} key={child.props.label}>
<React.Fragment>
{React.cloneElement(child, {
active: child.props.value === selectedTab,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! I've never used cloneElement but I guess it allows you to add props to passed in elements?

) {
setSliderWidth(
tabRefs.current[selectedTab - 1]!.getBoundingClientRect().width
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To handle resizing, I like to use the useResizeObserver hook from beautiful-react-hooks (you'll have to add the dependency).

You would attach a ref to the TabSliderContainer, get its width with the hook, add its width as a dependency to this useEffect, so we update the width/position of the tab whenever the container changes size.

Copy link
Member

@alexjball alexjball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good Mark! The animation is so satisfying :) I pushed a change to simplify the position calculation for tabs, and also increased the speed of the transition. lmk what you think.

to respond to your slack question, we should support resizing, that can happen if the user resizes their window while on the page.

There are a few spacing tweaks that can be done, but overall this is about ready to replace the current views. Let's work toward merging this PR in the next week. We can add pagination and wire up filtering by testifier type in a separate PR.

@alexjball
Copy link
Member

Also, @MarkTrepanier please merge in the latest changes from main. There is a new TestimonyContent component we should use instead of FormattedTestimonyContent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants