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

Right-hand sidebar for staking flow #132

Merged
merged 20 commits into from
Jan 17, 2024
Merged

Conversation

ioay
Copy link
Contributor

@ioay ioay commented Jan 3, 2024

Closes: #109

Screenshot 2024-01-05 at 09 03 24

@ioay ioay self-assigned this Jan 3, 2024
@ioay ioay force-pushed the right-hand-sidebar-staking-flow branch from 03e7ca7 to f69a4a5 Compare January 5, 2024 08:00
@ioay ioay marked this pull request as ready for review January 5, 2024 08:04
dapp/src/components/GlobalStyles/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
variant="outline"
justifyContent="flex-start"
leftIcon={<Icon as={ArrowUpRight} boxSize={6} color="brand.400" />}
onClick={openDocsDrawer}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just flagging - we probably should think about how to pass the section name to the docs drawer to open the correct docs there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we'll deal with it when the docs're ready.

dapp/src/components/GlobalStyles/index.tsx Outdated Show resolved Hide resolved
dapp/src/assets/images/right-sidebar-bg.png Outdated Show resolved Hide resolved
dapp/src/assets/images/coins-stacked.svg Outdated Show resolved Hide resolved
dapp/src/assets/images/shield-plus.svg Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/theme/Sidebar.ts Outdated Show resolved Hide resolved
@ioay ioay requested a review from kkosiorowska January 8, 2024 09:52
@ioay
Copy link
Contributor Author

ioay commented Jan 8, 2024

@kkosiorowska (#132 (comment)): We should keep all assets (like fonts/images, maybe also icons) in one assets directory to keep related things in one place (like we do for components, utils, etc). The structure of the dirs is more readable in this case. I moved it now because I needed an images directory, and without additional effort, I did also a fonts folder. Because the project is not very extensive yet, only one path change was needed in one file.

Copy link
Contributor

@kkosiorowska kkosiorowska left a comment

Choose a reason for hiding this comment

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

Icons for buttons are incorrectly sized. Please make sure that all sizes are set correctly.

Screenshot 2024-01-09 at 16 40 47 Screenshot 2024-01-09 at 16 42 35

dapp/src/static/icons/ShieldPlus.tsx Outdated Show resolved Hide resolved
@@ -18,6 +18,7 @@ const baseStyleSidebarContainer = defineStyle({
const baseStyleSidebar = defineStyle({
p: 4,
height: "100%",
w: "80",
Copy link
Contributor

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 shouldn't declare widths here. In the Sidebar component, we set it again. I would suggest moving it to the component and setting it for the sidebar element. Something like this:

<Box __css={styles.sidebar} w={80}>

Copy link
Contributor Author

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 shouldn't declare widths here. In the Sidebar component, we set it again. I would suggest moving it to the component and setting it for the sidebar element. Something like this:

<Box __css={styles.sidebar} w={80}>

It has to be here for 3 reasons:

  • it is not setting again, because you point Box with sidebarContainer class, this style is related to another Box with sidebar class.
  • I don't see the reason to keep an additional style prop if we have already defined custom sidebar.
  • we have to have defined fixed width, beacse in other case content inside this container while extending/collapsing sidebar content becomes floating too much, which looks very bad and we don't want this behavior.

Copy link
Member

Choose a reason for hiding this comment

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

If we define the width to fixed 80 value here and in the mentioned Sidebar component

w={isOpen ? 80 : 0}

We need to maintain the value in two places. Can we find a way to improve it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we define the width to fixed 80 value here and in the mentioned Sidebar component

w={isOpen ? 80 : 0}

We need to maintain the value in two places. Can we find a way to improve it?

Sure, I'll do that.

Copy link
Contributor

@kkosiorowska kkosiorowska Jan 11, 2024

Choose a reason for hiding this comment

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

I understand why we want to set this value. However, I still have doubts that it should be set in a component theme. I have doubts because what if we want to use this theme once again with a different width? This isn't likely to happen. But it makes me wonder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment, looking at the design, there are no such requirements - If there is such a need, we will change it.

dapp/src/theme/Card.ts Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
Comment on lines 85 to 92
variant="outline"
justifyContent="flex-start"
leftIcon={<Icon as={ArrowUpRight} boxSize={6} color="brand.400" />}
onClick={openDocsDrawer}
width="100%"
bg="gold.100"
borderColor="white"
borderStyle="solid"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can also use the colorScheme property here because this button looks like a card variant. Only the background and border color have been changed. Check how it was done here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a sidebar variant to the button style guide. Already existing card variants have too many differences and expanding it will make a mess.

@kkosiorowska
Copy link
Contributor

@kkosiorowska (#132 (comment)): We should keep all assets (like fonts/images, maybe also icons) in one assets directory to keep related things in one place (like we do for components, utils, etc). The structure of the dirs is more readable in this case. I moved it now because I needed an images directory, and without additional effort, I did also a fonts folder. Because the project is not very extensive yet, only one path change was needed in one file.

Sure, but I think we should not mix the changes with each other. Based on the directory structure, the space for the images was in the static folder. Of course, we can improve the structure and move them to the assets folder. But at this point in my opinion mixing it up causes a bit of a mess. Because some things have already been moved and some have not (for example icons). Doing it in a separate PR would be more clear.

@ioay
Copy link
Contributor Author

ioay commented Jan 9, 2024

@kkosiorowska (#132 (comment)): We should keep all assets (like fonts/images, maybe also icons) in one assets directory to keep related things in one place (like we do for components, utils, etc). The structure of the dirs is more readable in this case. I moved it now because I needed an images directory, and without additional effort, I did also a fonts folder. Because the project is not very extensive yet, only one path change was needed in one file.

Sure, but I think we should not mix the changes with each other. Based on the directory structure, the space for the images was in the static folder. Of course, we can improve the structure and move them to the assets folder. But at this point in my opinion mixing it up causes a bit of a mess. Because some things have already been moved and some have not (for example icons). Doing it in a separate PR would be more clear.

Already done in #142

@ioay ioay requested a review from kkosiorowska January 9, 2024 20:03
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
@ioay ioay requested a review from kkosiorowska January 11, 2024 19:46
dapp/src/theme/Sidebar.ts Outdated Show resolved Hide resolved
dapp/src/theme/Sidebar.ts Outdated Show resolved Hide resolved
dapp/src/theme/Sidebar.ts Outdated Show resolved Hide resolved
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
@ioay ioay requested a review from r-czajkowski January 15, 2024 17:48
Copy link
Contributor

@kkosiorowska kkosiorowska left a comment

Choose a reason for hiding this comment

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

I left some of my thoughts.

dapp/src/components/Sidebar/index.tsx Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Sidebar/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/shared/ButtonLink/index.tsx Outdated Show resolved Hide resolved
dapp/src/theme/Card.ts Outdated Show resolved Hide resolved
@@ -3,4 +3,7 @@ export const semanticTokens = {
header_height: 24,
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking comment

We would probably want to change the name for the header_height. Of course, this isn't the scope of this PR but it can be a bit confusing at the moment. What I mean is that looking at header_height you start to wonder why it isn't in the sizes category. We'll have to improve this in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's create a task for this, we agreed that we do not want to mix different changes in one PR, so let's stick to this rule.

dapp/src/components/shared/ButtonLink/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/shared/ButtonLink/index.tsx Outdated Show resolved Hide resolved
onClick: () => void
}

export default function ButtonLink({
Copy link
Contributor

@kkosiorowska kkosiorowska Jan 16, 2024

Choose a reason for hiding this comment

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

I wonder if it is better to remove some of the props and make this component more flexible. And do something very similar to what was done in the threshold dashboard. I'm thinking of something like this:

import React from "react"
import { Button, ButtonProps, Icon, Link, LinkProps } from "@chakra-ui/react"
import { ArrowUpRight } from "#/static/icons"

type ButtonLinkProps = ButtonProps &
  LinkProps & {
    icon?: typeof Icon
    iconColor?: string
  }

export default function ButtonLink({
  icon = ArrowUpRight,
  iconColor = "brand.400",
  ...props
}: ButtonLinkProps) {
  return (
    <Button
      as={Link}
      w="100%"
      justifyContent="start"
      leftIcon={<Icon as={icon} boxSize={4} color={iconColor} />}
      {...props}
    />
  )
}

<ButtonLink variant="solid" onClick={openDocsDrawer} iconColor="white">
  Docs
</ButtonLink>

In that case, we would also need to update the theme for the Link component. This is just a suggestion to improve this component. Let me know what you think, we could discuss it together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What kind of flexibility? Prop link was removed. This component will be changed so on, because of the approach to creating chakra icons (instead chakra icons will use a common Image component).

It will be changed if needed also here:
#141
#177

Copy link
Contributor

@kkosiorowska kkosiorowska Jan 16, 2024

Choose a reason for hiding this comment

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

What kind of flexibility

Some of my thoughts:

  • Currently, for the variant solid icon can only be white.
  • I don't see the point of declaring in props: justifyContent and variant. These props are already declared in the ButtonProps. You can easily change them using {...props} in the component or set default values as I show above. But do we want to set a default value for the variant? It makes me wonder.
  • In my opinion isFullWidth or label is also unnecessary. Instead of a label, we can pass children.
  • Also, Using this button as a Link, we can add more props. For example href. It will also clearly show that we are using this button as a link.

Copy link
Contributor Author

@ioay ioay Jan 16, 2024

Choose a reason for hiding this comment

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

  1. As I mentioned above - chakra icon will be changed to svg, so it's going to change. On Friday we agreed that the icon will be in orange/white color depending on the solid/outline variant. Let's leave it as it is.
  2. justifyContent is a prop, so it can be overridden if needed, but by default, all buttons need to be aligned to the left.
  3. ok, I'll change
  4. Let's not mix it up with link functionality now, if it will be needed we can extend this file or create a Link component to handle external href or handle it in the passed method onClick. We talked about this on Friday and we agreed as it is, so as not to go through the comments one more week.

If needs arise, this component and others can be developed further.

@ioay ioay requested a review from kkosiorowska January 16, 2024 10:05
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
dapp/src/theme/Button.ts Outdated Show resolved Hide resolved
dapp/src/theme/Card.ts Outdated Show resolved Hide resolved
dapp/src/theme/Card.ts Outdated Show resolved Hide resolved
dapp/src/theme/Card.ts Outdated Show resolved Hide resolved
@ioay ioay requested a review from r-czajkowski January 16, 2024 12:38
Copy link
Contributor

@r-czajkowski r-czajkowski left a comment

Choose a reason for hiding this comment

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

LGTM! Leaving final approval to Karolina.

Copy link
Contributor

@kkosiorowska kkosiorowska left a comment

Choose a reason for hiding this comment

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

I think we are ready to merge. 🚢 So let's not block that PR any longer. Some important notes:

  • The ButtonLink will be extended with the functionality of a link as it was done in the threshold dashboard. Created issue Extend buttonLink to handle href link #180
  • The handling of the use of icons/images in the dapp will change. So the ButtonLink will also be updated under this scope later.
  • At the moment, for the variant solid icon is always white for ButtonLink. Let's update this when needed or we all agree on the change.

@ioay ioay merged commit 911ee13 into main Jan 17, 2024
11 checks passed
@ioay ioay deleted the right-hand-sidebar-staking-flow branch January 17, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement right hand sidebar for Staking flow in Ledger Live dApp
5 participants