-
Notifications
You must be signed in to change notification settings - Fork 4
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
Activities bar - added carousel #287
Conversation
✅ Deploy Preview for acre-dapp-testnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
dda8a04
to
e174e27
Compare
50df52a
to
5044090
Compare
7a5df5f
to
389b9e2
Compare
f86bc1d
to
c7e0dfc
Compare
export function ActivityCardLinkWrapper({ | ||
activity, | ||
children, | ||
...props | ||
}: ActivityCardLinkWrapperProps) { | ||
return ( | ||
<ChakraLink | ||
as={ReactRouterLink} | ||
to="/activity-details" | ||
state={{ activity }} | ||
key={activity.txHash} | ||
{...props} | ||
> | ||
{children} | ||
</ChakraLink> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should use special compnent for that case from chakra - LinkOverlay
, because:
According to the specification](https://www.w3.org/TR/html5/text-level-semantics.html#the-a-element), an
<a>
element’s content model specifically states that an cannot contain any interactive descendants (button, anchors, input, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely convinced about this solution, since we end up using it anyway prop as={ReactRouterLink} which generates <a>
element (no matter if we use LinkOverlay/LinkBox). I'm wondering how we can get around this to meet the semantic assumptions 🤔
UPDATE:
Added click handler instead of using ChakraLink.: ba6d8ee
dapp/src/components/shared/Activities/ActivityCard/ActivityCardLinkWrapper.tsx
Outdated
Show resolved
Hide resolved
dapp/src/components/shared/Activities/ActivityCarousel/ActivityCarousel.tsx
Outdated
Show resolved
Hide resolved
@@ -29,7 +29,7 @@ export default function ActivityPage() { | |||
/> | |||
</ChakraLink> | |||
<Flex gap={10}> | |||
<ActivityBar flexDirection="column" /> | |||
<ActivityBar /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. I think we can keep the ActivityBar
under pages/AcrtivityPage
. Unless we update the ActivityBar
that can handle horizontal
and vertical
positions so we can use ActivityBar
inside the ActivityCarousel
but with horizontal position.
e0c9ce4
to
61c0943
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments after the tests:
- Not able to remove activity card when it is at the end of the carousel.
Screen.Recording.2024-03-22.at.14.06.01.mov
- Currently, when we have a lot of activity it doesn't look good.
Screen.Recording.2024-03-22.at.14.08.50.mov
dapp/src/pages/OverviewPage/ActivityCarousel/ActivityCarousel.tsx
Outdated
Show resolved
Hide resolved
// React-slick package: Chakra-ui with react-slick package doesn't | ||
// generate flex style for auto-generated slick-track wrapper. | ||
.slick-track { | ||
display: flex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that this is not a problem related to Chakra but to the fact that we have not imported styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if importing additional styles and then overriding the imported styles is needed. To add this kind of style with a lot of we have to install the additional package: slick-carousel
or import them from cdn
, another option is to add all these styles into the global styles file which leads to the same thing, only with more styles to remove/overwrite.
We just need to add display: flex
to the slick-track
class (this class is generated under the hood of react-slick, so we can't style it directly in the Carousel component). I'd leave it as it is if you don't mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following this approach, let's add a right description of why we do this. Let's document this decision.
Could you add more details on that resolution are you record this video? Remove functionality works well, but on this video - the gradient below the @SorinQ what do you think? Should we move the close button icon to another place or maybe we should reduce width of this gradient?
I added information in the PR description that is not related to the scope of this PR, please take a look at
|
_> > Some comments after the tests:
We should definitely reduce the gradient. |
I reduced the width of a gradient to 32px(but we will always find a resolution in which this close button will be unclickable). I implemented a responsively approach to showing cards, and depending on the resolution, we display the right amount of activity: |
dapp/src/pages/OverviewPage/ActivityCarousel/ActivityCarousel.tsx
Outdated
Show resolved
Hide resolved
overflow="hidden" | ||
ref={carouselRef} | ||
pl={2} | ||
ml={-2} | ||
overflowX="hidden" | ||
pb={6} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that we don't need it.
overflowX="hidden"
is already set in Carousel
pl={2}
ml={-2}
- it doesn't do anything
pb={6}
- Instead of bottom padding, let's set the gap
/pb
in the higher component.
overflow="hidden" | |
ref={carouselRef} | |
pl={2} | |
ml={-2} | |
overflowX="hidden" | |
pb={6} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overflow
- removed, remnants of changes during work on PR.
pl={2} ml={-2} - it doesn't do anything
It does - take a look at the shadow on the left side of the card(without these styles shadow is cut-off):
pb={6} - we can't do it as you propose, because, as I noticed, the carousel has overflow
added by default and when we remove this padding shadow below activityCard is cut off. We need this padding-bottom to be consistent with UX.
I added a comment on why we need it to code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, now I understand. Regarding the bottom padding, I would consider simply setting the right height of the component. It seems more intuitive to me to fit the right height content into a component than to use padding. But I leave it up to you.
// React-slick package: Chakra-ui with react-slick package doesn't | ||
// generate flex style for auto-generated slick-track wrapper. | ||
.slick-track { | ||
display: flex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following this approach, let's add a right description of why we do this. Let's document this decision.
[data-id="slick-arrow-prev"]:disabled:has(~ [data-id="slick-arrow-next"]:disabled), | ||
[data-id="slick-arrow-prev"]:disabled ~ [data-id="slick-arrow-next"]:disabled{ | ||
display: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not do it in global styles but in the code related to this carousel. But we can leave it that way now and move it in the future if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably won't change it also for other carousel components if appears. I added a comment to this style when was created:
// React-slick package: Hiding arrows instead of disabling them in case
// when carousel is not fully completed by slides.
<Grid | ||
templateAreas={'"activity-carousel activity-carousel docs-card"'} | ||
gridTemplateColumns="1fr 1fr auto" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in another commenter, we can move the spacing between elements to a higher component.
> | |
pb={6} | |
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
125234e
to
3b5aea0
Compare
<Flex | ||
as={Slider} | ||
ref={ref} | ||
// overflow="hidden" is required to hide the items outside the viewport. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking comment
I suggested adding a comment but I meant more to point out that the addition of this line is the result of not including external styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking comment
I'm confused but it seems to me that we shouldn't call the file that. The file name indicates the name of the exported component. But there is no such component in reality.
overflow="hidden" | ||
ref={carouselRef} | ||
pl={2} | ||
ml={-2} | ||
overflowX="hidden" | ||
pb={6} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, now I understand. Regarding the bottom padding, I would consider simply setting the right height of the component. It seems more intuitive to me to fit the right height content into a component than to use padding. But I leave it up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left minor non-blocking comments.
Based on the fact that design will change a bit soon, let's not focus so much on the visual layer.
Implement a carousel component
What was done:
react-slick, ver. ^0.30.2
|@types/react-slick: "^0.23.13"
React-slick is a carousel component built with React. It is a react port of a slick carousel: https://kenwheeler.github.io/slick/.
The first release was in 2015, the last release - 2 weeks ago.
Based on MIT license.
Weekly downloads: 1,071,550
Unpacked Size only: 815 kB
Stars on GitHub: 11.5k
Docs: https://react-slick.neostack.com/
More details: https://www.npmjs.com/package/react-slick
Repository: https://github.com/akiran/react-slick
Preview:
Additional info: