Small fixes for LeftPaneDialog
This commit is contained in:
parent
87ea95735e
commit
4d180a26fe
2 changed files with 20 additions and 5 deletions
|
@ -11,8 +11,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.LeftPaneDialog {
|
.LeftPaneDialog {
|
||||||
@include button-reset;
|
|
||||||
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: $color-ultramarine;
|
background: $color-ultramarine;
|
||||||
color: $color-white;
|
color: $color-white;
|
||||||
|
@ -23,6 +21,10 @@
|
||||||
user-select: none;
|
user-select: none;
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
|
|
||||||
|
&--clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
&__container {
|
&__container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -59,6 +59,17 @@ export const LeftPaneDialog: React.FC<PropsType> = ({
|
||||||
onClick?.();
|
onClick?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onKeyDownWrap = (e: React.KeyboardEvent) => {
|
||||||
|
if (e.key !== 'Enter' && e.key !== ' ') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
onClick?.();
|
||||||
|
};
|
||||||
|
|
||||||
const onCloseWrap = (e: React.MouseEvent) => {
|
const onCloseWrap = (e: React.MouseEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -109,6 +120,7 @@ export const LeftPaneDialog: React.FC<PropsType> = ({
|
||||||
const className = classNames([
|
const className = classNames([
|
||||||
BASE_CLASS_NAME,
|
BASE_CLASS_NAME,
|
||||||
type === undefined ? undefined : `${BASE_CLASS_NAME}--${type}`,
|
type === undefined ? undefined : `${BASE_CLASS_NAME}--${type}`,
|
||||||
|
onClick === undefined ? undefined : `${BASE_CLASS_NAME}--clickable`,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
|
@ -128,16 +140,17 @@ export const LeftPaneDialog: React.FC<PropsType> = ({
|
||||||
|
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
return (
|
return (
|
||||||
<button
|
<div
|
||||||
className={className}
|
className={className}
|
||||||
type="button"
|
role="button"
|
||||||
onClick={onClickWrap}
|
onClick={onClickWrap}
|
||||||
|
onKeyDown={onKeyDownWrap}
|
||||||
aria-label={clickLabel}
|
aria-label={clickLabel}
|
||||||
title={hoverText}
|
title={hoverText}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</button>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue