add "reset to default" color option for ColorPicker (#8643)

* add reset to default color option

* Do not show reset button in DOM if resetDefaultValue is undefined

* handle edge case: if invalid hexcode is set for resetDefaultValue

* Do not show the reset button if the color is already set to the default value

* Remove data-testid from Button

---------

Co-authored-by: Praneeth Bhogaraju <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-05-05 13:25:18 +01:00
1 parent 76807a7e70
commit 371e7b024a
3 files changed
+28

No files matched your search

@@ -151,6 +151,7 @@ const ProfileView = () => {
<p className="text-emphasis mb-2 block text-sm font-medium">{t("light_brand_color")}</p>
<ColorPicker
defaultValue={team.brandColor}
resetDefaultValue="#292929"
onChange={(value) => form.setValue("brandColor", value, { shouldDirty: true })}
/>
</div>
@@ -165,6 +166,7 @@ const ProfileView = () => {
<p className="text-emphasis mb-2 block text-sm font-medium">{t("dark_brand_color")}</p>
<ColorPicker
defaultValue={team.darkBrandColor}
resetDefaultValue="#fafafa"
onChange={(value) => form.setValue("darkBrandColor", value, { shouldDirty: true })}
/>
</div>