feat(core-blocks): CB-1056 change revel icon color

This commit is contained in:
Naumov Alexey
2021-06-22 14:58:07 +03:00
parent 1655a4025d
commit 24c422abab
3 changed files with 15 additions and 6 deletions
@@ -10,6 +10,7 @@ import { observer } from 'mobx-react-lite';
import { useCallback, useContext, useState } from 'react';
import styled, { use, css } from 'reshadow';
import { useTranslate } from '@cloudbeaver/core-localization';
import { ComponentStyle, composes, useStyles } from '@cloudbeaver/core-theming';
import type { ILayoutSizeProps } from '../Containers/ILayoutSizeProps';
@@ -21,7 +22,7 @@ import { isControlPresented } from './isControlPresented';
const INPUT_FIELD_STYLES = composes(
css`
Icon {
composes: theme-text-primary from global;
composes: theme-text-on-secondary from global;
}
`,
css`
@@ -36,11 +37,12 @@ const INPUT_FIELD_STYLES = composes(
input-container {
position: relative;
}
Icon {
icon-container {
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
display: flex;
width: 24px;
height: 24px;
cursor: pointer;
@@ -107,6 +109,7 @@ export const InputFieldNew: InputFieldType = observer(function InputFieldNew({
...rest
}: ControlledProps | ObjectProps<any, any>, ref: React.Ref<HTMLInputElement>) {
const [passwordRevealed, setPasswordRevealed] = useState(false);
const translate = useTranslate();
const styles = useStyles(baseFormControlStylesNew, INPUT_FIELD_STYLES, style);
const context = useContext(FormContext);
@@ -164,11 +167,15 @@ export const InputFieldNew: InputFieldType = observer(function InputFieldNew({
required={required}
/>
{showRevealPasswordButton && (
<Icon
name={passwordRevealed ? 'password-hide' : 'password-show'}
viewBox='0 0 16 16'
<icon-container
title={translate('ui_reveal_password')}
onClick={revealPassword}
/>
>
<Icon
name={passwordRevealed ? 'password-hide' : 'password-show'}
viewBox='0 0 16 16'
/>
</icon-container>
)}
</input-container>
{description && (
@@ -31,6 +31,7 @@ export const defaultENLocale = [
['ui_copy_to_clipboard_failed_to_copy', 'Failed to copy'],
['ui_clipboard_access_denied_title', 'Clipboard access denied'],
['ui_clipboard_access_denied_message', 'You need to give access to clipboard to use some of the app features'],
['ui_reveal_password', 'Show or hide password'],
['root_permission_denied', 'You have no permissions'],
['app_root_session_expired_title', 'Session expired'],
['app_root_session_expired_message', 'Session has been expired. Do you want to reload?'],
@@ -29,6 +29,7 @@ export const defaultRULocale = [
['ui_copy_to_clipboard_failed_to_copy', 'Не удалось скопировать'],
['ui_clipboard_access_denied_title', 'Доступ к буферу обмена запрещен'],
['ui_clipboard_access_denied_message', 'Чтобы использовать некоторые функции приложения, необходим доступ к буферу обмена'],
['ui_reveal_password', 'Показать или скрыть пароль'],
['root_permission_denied', 'Отказано в доступе'],
['app_root_session_expired_title', 'Сессия истекла'],
['app_root_session_expired_message', 'Сессия истекла. Хотите перезагрузить страницу?'],