-
Notifications
You must be signed in to change notification settings - Fork 323
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
feat: Add inverted variant to Tipseen and Steps #1995
Changes from all commits
5e5da5d
be324f7
84f11c5
8221549
eaa1755
2fc52ba
cad1d01
012414c
d545f8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,6 +222,23 @@ $disabled-on-primary-color-opacity: 0.5; | |
color: var(--fixed-light-color); | ||
} | ||
|
||
.kindPrimary.colorOnInvertedBackground { | ||
background: var(--primary-background-color); | ||
color: var(--primary-text-color); | ||
} | ||
|
||
.kindPrimary.colorOnInvertedBackgroundActive, | ||
.kindPrimary.colorOnInvertedBackground:hover, | ||
.kindPrimary.colorOnInvertedBackground:focus { | ||
background: var(--ui-background-color); | ||
} | ||
|
||
.kindPrimary.button.colorOnInvertedBackground.disabled { | ||
background: var(--ui-background-color); | ||
color: var(--primary-text-color); | ||
opacity: $disabled-on-primary-color-opacity; | ||
} | ||
|
||
.kindPrimary.button.disabled { | ||
background: var(--disabled-background-color); | ||
color: var(--disabled-text-color); | ||
|
@@ -341,6 +358,23 @@ $disabled-on-primary-color-opacity: 0.5; | |
@include focus-style-on-primary(); | ||
} | ||
|
||
.kindSecondary.colorOnInvertedBackground { | ||
border-color: var(--text-color-on-inverted); | ||
color: var(--text-color-on-inverted); | ||
} | ||
|
||
.kindSecondary.colorOnInvertedBackgroundActive, | ||
.kindSecondary.colorOnInvertedBackground:hover, | ||
.kindSecondary.colorOnInvertedBackground:focus { | ||
background: var(--icon-color); | ||
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-semantic color warning 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. I know, it is the same issue that I talked with you about it yesterday, we don't have semantic colors for the inverted colors :( |
||
} | ||
|
||
.kindSecondary.colorOnInvertedBackground.disabled { | ||
border-color: var(--text-color-on-inverted); | ||
color: var(--text-color-on-inverted); | ||
opacity: $disabled-on-primary-color-opacity; | ||
} | ||
|
||
.kindSecondary.colorFixedLight.disabled { | ||
opacity: $disabled-on-primary-color-opacity; | ||
color: var(--fixed-light-color); | ||
|
@@ -459,7 +493,13 @@ $disabled-on-primary-color-opacity: 0.5; | |
.kindTertiary.colorOnInvertedBackgroundActive, | ||
.kindTertiary.colorOnInvertedBackground:hover, | ||
.kindTertiary.colorOnInvertedBackground:focus { | ||
backdrop-filter: brightness(85%); | ||
background: var(--icon-color); | ||
} | ||
|
||
.kindTertiary.colorOnInvertedBackground.disabled { | ||
background: var(--icon-color); | ||
opacity: $disabled-on-primary-color-opacity; | ||
color: var(--text-color-on-inverted); | ||
} | ||
|
||
.kindTertiary.disabled { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,12 @@ import NavigationChevronLeft from "../../components/Icon/Icons/components/Naviga | |
import Icon from "../../components/Icon/Icon"; | ||
import Button, { ButtonProps } from "../../components/Button/Button"; | ||
import { NOOP } from "../../utils/function-utils"; | ||
import { BACK_TEXT, NEXT_TEXT } from "./StepsConstants"; | ||
import { BACK_TEXT, NEXT_TEXT, StepsColor } from "./StepsConstants"; | ||
import VibeComponentProps from "../../types/VibeComponentProps"; | ||
import { ComponentDefaultTestId } from "../../tests/constants"; | ||
import styles from "./StepsCommand.module.scss"; | ||
import { camelCase } from "lodash-es"; | ||
import { getStyle } from "../..//helpers/typesciptCssModulesHelper"; | ||
|
||
export interface StepsCommandProps extends VibeComponentProps { | ||
isNext?: boolean; | ||
|
@@ -17,7 +19,7 @@ export interface StepsCommandProps extends VibeComponentProps { | |
stepsCount: number; | ||
isIconHidden?: boolean; | ||
buttonProps?: ButtonProps; | ||
isOnPrimary?: boolean; | ||
color?: StepsColor; | ||
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. Isn't it breaking? 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. In principle, all these components should not be used by themselves, they are the children of the |
||
} | ||
|
||
export const StepsCommand: FC<StepsCommandProps> = ({ | ||
|
@@ -26,15 +28,14 @@ export const StepsCommand: FC<StepsCommandProps> = ({ | |
activeStepIndex, | ||
stepsCount, | ||
isIconHidden = false, | ||
isOnPrimary = false, | ||
buttonProps = {} | ||
buttonProps = {}, | ||
color = StepsColor.PRIMARY | ||
}) => { | ||
const { children: buttonChildren, ...otherButtonProps } = buttonProps; | ||
const description = useMemo(() => { | ||
if (buttonChildren) return buttonChildren; | ||
return isNext ? NEXT_TEXT : BACK_TEXT; | ||
}, [isNext, buttonChildren]); | ||
const buttonBaseColor = isOnPrimary ? Button.colors.ON_PRIMARY_COLOR : undefined; | ||
const newStepIndex = isNext ? activeStepIndex + 1 : activeStepIndex - 1; | ||
const onClick = useCallback( | ||
(e: React.MouseEvent) => onChangeActiveStep(e, newStepIndex), | ||
|
@@ -52,17 +53,17 @@ export const StepsCommand: FC<StepsCommandProps> = ({ | |
kind={Button.kinds.TERTIARY} | ||
onClick={onClick} | ||
disabled={isDisabled} | ||
color={buttonBaseColor} | ||
// @ts-ignore | ||
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. Why ignore here? |
||
color={color} | ||
{...otherButtonProps} | ||
> | ||
{description} | ||
{isIconHidden ? null : ( | ||
<Icon | ||
icon={icon} | ||
clickable={false} | ||
className={cx(styles.icon, { | ||
[styles.disabled]: isDisabled, | ||
[styles.onPrimary]: isOnPrimary | ||
className={cx(styles.icon, getStyle(styles, camelCase("color-" + color)), { | ||
[styles.disabled]: isDisabled | ||
})} | ||
/> | ||
)} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,9 @@ export enum StepsDotAriaCurrent { | |
DATE = "date", | ||
TIME = "time" | ||
} | ||
|
||
export enum StepsColor { | ||
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. Is it possible that we use TS types here instead of enums? Less for the migration 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. Sure! I forgot we talked about it, I'll change it in all the files I touched |
||
PRIMARY = "primary", | ||
ON_PRIMARY_COLOR = "on-primary-color", | ||
ON_INVERTED_BACKGROUND = "on-inverted-background" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import cx from "classnames"; | |
import { StepsCommand } from "./StepsCommand"; | ||
import { StepsGalleryHeader, StepsGalleryHeaderProps } from "./StepsGalleryHeader"; | ||
import { StepsNumbersHeader, StepsNumbersHeaderProps } from "./StepsNumbersHeader"; | ||
import { StepsType, FINISH_TEXT } from "./StepsConstants"; | ||
import { StepsType, FINISH_TEXT, StepsColor } from "./StepsConstants"; | ||
import VibeComponentProps from "../../types/VibeComponentProps"; | ||
import Button, { ButtonProps } from "../Button/Button"; | ||
import styles from "./StepsHeader.module.scss"; | ||
|
@@ -18,7 +18,7 @@ export interface StepsHeaderProps extends VibeComponentProps { | |
nextButtonProps: ButtonProps; | ||
finishButtonProps: ButtonProps; | ||
areButtonsIconsHidden: boolean; | ||
isOnPrimary: boolean; | ||
color?: StepsColor; | ||
onFinish?: (e: React.MouseEvent) => void; | ||
} | ||
|
||
|
@@ -32,7 +32,7 @@ export const StepsHeader: FC<StepsHeaderProps> = ({ | |
nextButtonProps, | ||
finishButtonProps, | ||
areButtonsIconsHidden, | ||
isOnPrimary, | ||
color = StepsColor.PRIMARY, | ||
onFinish, | ||
className | ||
}) => { | ||
|
@@ -57,23 +57,20 @@ export const StepsHeader: FC<StepsHeaderProps> = ({ | |
activeStepIndex={activeStepIndex} | ||
stepsCount={stepsCount} | ||
buttonProps={backButtonProps} | ||
isOnPrimary={isOnPrimary} | ||
color={color} | ||
/> | ||
)} | ||
<SubHeaderComponent | ||
activeStepIndex={activeStepIndex} | ||
stepsCount={stepsCount} | ||
onChangeActiveStep={onChangeActiveStep} | ||
isOnPrimary={isOnPrimary} | ||
color={color} | ||
/> | ||
{areNavigationButtonsHidden ? null : ( | ||
<> | ||
{showFinishButton ? ( | ||
<Button | ||
onClick={onFinish} | ||
color={isOnPrimary ? Button.colors.ON_PRIMARY_COLOR : undefined} | ||
{...finishButtonProps} | ||
> | ||
// @ts-ignore | ||
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. why ignore? 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. because 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. Do they have the same values? I wonder if we can do something about it |
||
<Button onClick={onFinish} color={color} {...finishButtonProps}> | ||
{finishButtonProps?.children || FINISH_TEXT} | ||
</Button> | ||
) : ( | ||
|
@@ -84,7 +81,7 @@ export const StepsHeader: FC<StepsHeaderProps> = ({ | |
onChangeActiveStep={onChangeActiveStep} | ||
stepsCount={stepsCount} | ||
buttonProps={nextButtonProps} | ||
isOnPrimary={isOnPrimary} | ||
color={color} | ||
/> | ||
)} | ||
</> | ||
|
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 need to nest this stylesheet sometime, it would be easier to read and understand