-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
389b9e2
Activities bar - added carousel
ioay c7e0dfc
Merge branch 'main' into carousel-component-activities
ioay 401f253
Added ArrowUpRightAnimatedIcon component
ioay f1218a7
Added chakraSpacingUnit
ioay 7344c8b
Styles improvements
ioay 19d3693
Activities carousel structure refactoring
ioay e93e0ae
Update react-router: based on id params instead of passing state
ioay ba6d8ee
ActivityCard linking, overviewPage improvements
ioay c78989f
Moved carousel to shared components
ioay 1dd7153
Merge branch 'main' into carousel-component-activities
ioay 1c5585a
Structure update, moved mocked activities to standalone hooks, minor …
ioay 61c0943
Merge branch 'main' into carousel-component-activities
ioay cea8744
Moving logic related to activities to useActivities hook
ioay ae675fd
Carousel arrow rendering (mapping)
ioay ebb5f11
Reduce width of gradient under Documentation Card
ioay 40e709a
Docs card minor change, rename settings file
ioay e870660
Merge branch 'main' into carousel-component-activities
ioay eae0720
Styles update & added useCallback to useActivity hook
ioay 3b5aea0
Moved carosuel settings directly to carousel component
ioay a6ba5d6
Merge branch 'main' into carousel-component-activities
ioay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
66 changes: 66 additions & 0 deletions
66
dapp/src/assets/icons/animated/ArrowUpRightAnimatedIcon.tsx
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from "react" | ||
import { ArrowUpRight } from "#/assets/icons" | ||
import { Box, Icon } from "@chakra-ui/react" | ||
import { Variants, motion } from "framer-motion" | ||
import { chakraUnitToPx } from "#/theme/utils" | ||
|
||
const arrowUpVariants: Variants = { | ||
initial: { | ||
x: 0, | ||
y: -5, | ||
}, | ||
animate: (boxSizePx: number) => ({ | ||
x: [0, boxSizePx], | ||
y: [-5, -boxSizePx], | ||
transition: { | ||
duration: 0.4, | ||
ease: "easeInOut", | ||
}, | ||
}), | ||
} | ||
|
||
const arrowBottomVariants: Variants = { | ||
initial: (boxSizePx: number) => ({ | ||
x: -boxSizePx, | ||
y: boxSizePx, | ||
}), | ||
animate: (boxSizePx: number) => ({ | ||
x: [-boxSizePx, 0], | ||
y: [boxSizePx, -5], | ||
transition: { | ||
duration: 0.4, | ||
ease: "easeInOut", | ||
}, | ||
}), | ||
} | ||
|
||
type ArrowUpRightAnimatedIconProps = { | ||
boxSize?: number | ||
color?: string | ||
} | ||
|
||
export function ArrowUpRightAnimatedIcon({ | ||
boxSize = 4, | ||
color = "brand.400", | ||
}: ArrowUpRightAnimatedIconProps) { | ||
const boxSizePx = chakraUnitToPx(boxSize) | ||
return ( | ||
<Box pos="relative" boxSize={boxSize} overflow="hidden"> | ||
{[ | ||
{ id: "arrow-up", variants: arrowUpVariants }, | ||
{ id: "arrow-bottom", variants: arrowBottomVariants }, | ||
].map(({ id, variants }) => ( | ||
<Box | ||
key={id} | ||
pos="absolute" | ||
as={motion.div} | ||
boxSize={boxSize} | ||
custom={boxSizePx} | ||
variants={variants} | ||
> | ||
<Icon as={ArrowUpRight} boxSize={boxSize} color={color} /> | ||
</Box> | ||
))} | ||
</Box> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./ArrowUpRightAnimatedIcon" |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./ActivityCard" |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { forwardRef } from "react" | ||
import { FlexProps, Flex } from "@chakra-ui/react" | ||
import Slider, { Settings as SliderProps } from "react-slick" | ||
|
||
const carouselSettings: SliderProps = { | ||
dots: false, | ||
infinite: false, | ||
draggable: false, | ||
variableWidth: true, | ||
speed: 500, | ||
slidesToShow: 12, | ||
slidesToScroll: 1, | ||
} | ||
|
||
type CarouselProps = FlexProps & | ||
SliderProps & { | ||
children: React.ReactNode | ||
} | ||
|
||
export const Carousel = forwardRef<HTMLInputElement, CarouselProps>( | ||
(props, ref) => ( | ||
<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 commentThe 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. |
||
overflow="hidden" | ||
{...carouselSettings} | ||
{...props} | ||
> | ||
{props.children} | ||
</Flex> | ||
), | ||
) |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: