1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fix tag input on firefox, do refactor on it

This commit is contained in:
Fedor Katurov 2023-10-26 12:57:36 +06:00
parent a2a60aee8e
commit 29ed51b831
4 changed files with 34 additions and 31 deletions

View file

@ -7,30 +7,30 @@ import { Icon } from '~/components/input/Icon';
import styles from './styles.module.scss';
interface IProps {
className?: string;
size?: string;
color?: 'primary' | 'danger' | 'info' | 'black' | 'default';
deletable?: boolean;
hoverable?: boolean;
editing?: boolean;
hasInput?: boolean;
onClick?: () => void;
onDelete?: () => void;
title?: string;
}
const TagWrapper: FC<IProps> = ({
className,
color = 'default',
children,
size,
deletable,
hoverable,
editing,
hasInput,
onClick,
onDelete,
title = '',
}) => {
const canBeDeleted = deletable && !editing && !hasInput;
const canBeDeleted = deletable && !editing;
const onDeletePress = useCallback(
(event) => {
if (!onDelete) {
@ -53,9 +53,9 @@ const TagWrapper: FC<IProps> = ({
[styles.hoverable]: hoverable,
[styles.editing]: editing,
[styles.deletable]: canBeDeleted,
[styles.input]: hasInput,
[styles.clickable]: onClick,
},
className,
)}
onClick={onClick}
>

View file

@ -34,11 +34,6 @@ $big: 1.2;
background-color: $content_bg;
}
&.input {
color: transparent !important;
min-width: 100px;
}
&.clickable {
cursor: pointer;
}
@ -76,26 +71,6 @@ $big: 1.2;
height: $tag_height * $big;
}
}
input {
background: none;
border: none;
color: white;
outline: none;
display: inline-flex;
position: absolute;
font: inherit;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
min-width: 100px;
padding-left: $tag_height;
padding-right: 5px;
box-sizing: border-box;
}
}
.hole {

View file

@ -130,10 +130,12 @@ const TagInput: FC<IProps> = ({ exclude, onAppend, onClearTag, onSubmit }) => {
<div className={styles.wrap} ref={wrapper}>
<TagWrapper
title={input || placeholder}
hasInput={true}
color={isAlbumTag ? 'primary' : undefined}
deletable={false}
className={styles.tag}
>
<input
className={styles.input}
type="text"
value={input}
size={1}

View file

@ -1,6 +1,32 @@
@import "src/styles/variables";
@import 'src/styles/variables';
.wrap {
position: relative;
z-index: 20;
}
.tag {
color: transparent !important;
min-width: 100px;
}
.input {
background: none;
border: none;
color: white;
outline: none;
display: inline-flex;
position: absolute;
font: inherit;
left: 0;
right: 0;
top: 0;
bottom: 0;
height: 100%;
width: 100%;
min-width: 100px;
padding-left: $tag_height;
padding-right: 5px;
box-sizing: border-box;
}