-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Validations): fixedValidationTextColors and darkTheme feature fl…
…ags (#3420)
- Loading branch information
1 parent
f805126
commit 248da6f
Showing
10 changed files
with
144 additions
and
12 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...ct-ui-validations/.creevey/images/ValidationContainer/Default/chromeDefault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...ey/images/ValidationContainer/With Wrapper Error Without Span/chromeDefault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
.../docs/Pages/Displaying/FeatureFlags/FeatureFlagsExampleFixedValidationTextColors.demo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { Gapped, Input } from '@skbkontur/react-ui'; | ||
|
||
import { | ||
text, | ||
ValidationContainer, | ||
ValidationsFeatureFlagsContext, | ||
ValidationWrapper, | ||
} from '../../../../src'; | ||
|
||
export default function FeatureFlagsExampleFixedValidationTextColors() { | ||
return ( | ||
<ValidationsFeatureFlagsContext.Provider value={{ fixedValidationTextColors: true }}> | ||
<ValidationContainer> | ||
<Gapped style={{ padding: '10px 0 32px 10px' }}> | ||
<ValidationWrapper | ||
validationInfo={{ | ||
level: 'error', | ||
type: 'immediate', | ||
independent: false, | ||
message: 'Error message', | ||
}} | ||
renderMessage={text('bottom')} | ||
> | ||
<Input /> | ||
</ValidationWrapper> | ||
<ValidationWrapper | ||
validationInfo={{ | ||
level: 'warning', | ||
type: 'immediate', | ||
independent: false, | ||
message: 'Warning message', | ||
}} | ||
renderMessage={text('bottom')} | ||
> | ||
<Input /> | ||
</ValidationWrapper> | ||
</Gapped> | ||
</ValidationContainer> | ||
</ValidationsFeatureFlagsContext.Provider> | ||
); | ||
} |
44 changes: 44 additions & 0 deletions
44
...es/Displaying/FeatureFlags/FeatureFlagsExampleFixedValidationTextColorsDarkTheme.demo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { Gapped, Input } from '@skbkontur/react-ui'; | ||
|
||
import { | ||
text, | ||
ValidationContainer, | ||
ValidationsFeatureFlagsContext, | ||
ValidationWrapper, | ||
} from '../../../../src'; | ||
|
||
export default function FeatureFlagsExampleFixedValidationTextColorsDarkTheme() { | ||
return ( | ||
<ValidationsFeatureFlagsContext.Provider | ||
value={{ fixedValidationTextColors: true, darkTheme: true }} | ||
> | ||
<ValidationContainer> | ||
<Gapped style={{ background: '#2b2b2b', padding: '10px 0 32px 10px' }}> | ||
<ValidationWrapper | ||
validationInfo={{ | ||
level: 'error', | ||
type: 'immediate', | ||
independent: false, | ||
message: 'Error message', | ||
}} | ||
renderMessage={text('bottom')} | ||
> | ||
<Input /> | ||
</ValidationWrapper> | ||
<ValidationWrapper | ||
validationInfo={{ | ||
level: 'warning', | ||
type: 'immediate', | ||
independent: false, | ||
message: 'Warning message', | ||
}} | ||
renderMessage={text('bottom')} | ||
> | ||
<Input /> | ||
</ValidationWrapper> | ||
</Gapped> | ||
</ValidationContainer> | ||
</ValidationsFeatureFlagsContext.Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...ges/react-ui-validations/src/utils/featureFlagsContext/ValidationsFeatureFlagsContext.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/react-ui-validations/src/utils/getValidationTextColor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { ValidationLevel } from '../ValidationWrapperInternal'; | ||
|
||
export function getValidationTextColor(darkTheme = false, level: ValidationLevel = 'error') { | ||
switch (level) { | ||
case 'warning': | ||
return darkTheme ? '#fdd481' : '#ef8b17'; | ||
case 'error': | ||
return darkTheme ? '#ff887b' : '#cb3d35'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters