Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/components/CategoryList/CategoryList.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default class CategoryList extends React.Component {
this.listWrapperRef = React.createRef();
this.state = {
openClasses: [],
hoveredFilter: null,
hoveredClass: null,
};
}

Expand Down Expand Up @@ -170,7 +172,11 @@ export default class CategoryList extends React.Component {
const link = generatePath(this.context, (this.props.linkPrefix || '') + (c.link || id));
return (
<div key={id}>
<div className={styles.link}>
<div
className={styles.link}
onMouseEnter={() => this.setState({ hoveredClass: id })}
onMouseLeave={() => this.setState({ hoveredClass: null })}
>
<Link
title={c.name}
to={{ pathname: link }}
Expand All @@ -194,6 +200,7 @@ export default class CategoryList extends React.Component {
{c.onEdit && (
<a
className={styles.edit}
style={{ opacity: this.state.hoveredClass === id ? 1 : 0 }}
onClick={e => {
e.preventDefault();
c.onEdit();
Expand Down Expand Up @@ -221,8 +228,14 @@ export default class CategoryList extends React.Component {
const url = id
? `${this.props.linkPrefix}${c.name}?filters=${encodeURIComponent(filter)}&filterId=${id}`
: `${this.props.linkPrefix}${c.name}?filters=${encodeURIComponent(filter)}`;
const filterKey = `${c.name}-${index}`;
return (
<div key={index} className={styles.childLink}>
<div
key={index}
className={styles.childLink}
onMouseEnter={() => this.setState({ hoveredFilter: filterKey })}
onMouseLeave={() => this.setState({ hoveredFilter: null })}
>
<Link
className={selectedFilter === index ? styles.active : ''}
onClick={e => {
Expand All @@ -236,6 +249,7 @@ export default class CategoryList extends React.Component {
{this.props.onEditFilter && (
<a
className={styles.editFilter}
style={{ opacity: this.state.hoveredFilter === filterKey ? 1 : 0 }}
onClick={e => {
e.preventDefault();
this.props.onEditFilter(c.name, filterData);
Expand Down
12 changes: 0 additions & 12 deletions src/components/CategoryList/CategoryList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@
align-items: flex-start;
padding-top: 2px;
cursor: pointer;
opacity: 0;
transition: opacity 0.2s ease;
svg {
fill: #8fb9cf;
}
Expand All @@ -111,10 +109,6 @@
}
}
}

&:hover .edit {
opacity: 1;
}
}

.childLink {
Expand All @@ -138,8 +132,6 @@
align-items: flex-start;
padding-top: 2px;
cursor: pointer;
opacity: 0;
transition: opacity 0.2s ease;
svg {
fill: #8fb9cf;
}
Expand All @@ -149,8 +141,4 @@
}
}
}

&:hover .editFilter {
opacity: 1;
}
}
Loading