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:
3 files changed
+28
No files matched your search
@@ -146,6 +146,7 @@ const AppearanceView = () => {
|
||||
<p className="text-default mb-2 block text-sm font-medium">{t("light_brand_color")}</p>
|
||||
<ColorPicker
|
||||
defaultValue={user.brandColor}
|
||||
resetDefaultValue="#292929"
|
||||
onChange={(value) => {
|
||||
if (!checkWCAGContrastColor("#ffffff", value)) {
|
||||
setLightModeError(true);
|
||||
@@ -167,6 +168,7 @@ const AppearanceView = () => {
|
||||
<p className="text-default mb-2 block text-sm font-medium">{t("dark_brand_color")}</p>
|
||||
<ColorPicker
|
||||
defaultValue={user.darkBrandColor}
|
||||
resetDefaultValue="#fafafa"
|
||||
onChange={(value) => {
|
||||
if (!checkWCAGContrastColor("#101010", value)) {
|
||||
setDarkModeError(true);
|
||||
|
||||
Reference in new issue
Block a user