cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

add "reset to default" color option for ColorPicker

Open Praneeth2k opened this issue 1 year ago • 5 comments

What does this PR do?

Fixes #8642 Adds the option to reset to the default color.

https://user-images.githubusercontent.com/47350983/235989553-07d3de0b-e109-4f40-bd9e-0d9d1132893f.mp4

Description of the code changes:

ColorPicker

  • Add a non-required prop to the props passed on the the component called "resetDefaultValue".
  • Add a button which has the RotateCcw icon. This icon is invisible by default. Only if the resetDefaultValue is passed on by the part component, this icon will be visible.
  • Upon clicking this icon, the color is set to the "resetDefaultValue"

The color picker component is used in 3 places:

  1. Appearance section for a user: https://app.cal.com/settings/my-account/appearance - 2 instances. Default resetDefaultValue of #292929 and #fafafa added for light and dark themes .
  2. Appearance section for a Team - 2 instances. Default resetDefaultValue of #292929 and #fafafa added for light and dark themes .
  3. The Embed option for a meeting - 1 instance. resetDefaultValue has not been set meaning the reset icon will not appear.

Environment: Staging(main branch) / Production

Type of change

  • New feature (non-breaking change which adds functionality)

How should this be tested?

  • [x] Set the color to a different value and then use the reset option.
  • [x] Click on Update at the bottom without using the reset option and refresh page to ensure that the color is saved.
  • [x] Click on Update at the bottom after using the reset option and refresh page to ensure that the color is saved.

Praneeth2k avatar May 03 '23 17:05 Praneeth2k

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

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2023 6:17pm

vercel[bot] avatar May 03 '23 17:05 vercel[bot]

Someone is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 03 '23 17:05 vercel[bot]

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Two Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/apps/[slug]/[...pages] 456.4 KB 606.89 KB 173.40% (🟡 +0.23%)
/auth/setup 174.63 KB 325.12 KB 92.89% (🟡 +0.16%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/-

github-actions[bot] avatar May 03 '23 17:05 github-actions[bot]

Thanks for fixing the issues addressed - The reset button doesnt seem to hide when the values are default

sean-brydon avatar May 04 '23 11:05 sean-brydon

The reset button doesnt seem to hide when the values are default

@sean-brydon, Just to clarify, what I was trying to achieve is that if the "resetDefaultValue" was not passed on to the component then there is no value to reset to, hence the button should not show up.

I agree that it would be nice if we do not show the reset button if the color is already set to the default value. I have pushed the changes to implement this.

Thanks for the suggestion!

Praneeth2k avatar May 04 '23 12:05 Praneeth2k