Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: column title tooltip #4279

Merged
merged 8 commits into from
Jul 2, 2024
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
9 changes: 9 additions & 0 deletions src/components/Column/Column.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
color: $color-middle-gray;
}

// tooltip requires parent selection because of specificity
.column__header-text-wrapper .column__tooltip {
@include tooltip--light;
}

.column__header-input {
display: flex;
align-items: center;
Expand Down Expand Up @@ -168,6 +173,10 @@
color: $color-middle-gray;
}

.column__header-text-wrapper .column__tooltip {
@include tooltip--dark;
}

.column__notes-wrapper {
scrollbar-color: $color-darkest-gray $color-dark-mode-note;
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Column/Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Color, getColorClassName} from "constants/colors";
import {NoteInput} from "components/NoteInput";
import {useEffect, useRef, useState} from "react";
import classNames from "classnames";
import {Tooltip} from "react-tooltip";
import {useAppSelector} from "store";
import {Actions} from "store/action";
import {Close, MarkAsDone, Hidden, ThreeDots} from "components/Icon";
Expand Down Expand Up @@ -93,6 +94,7 @@ export const Column = ({id, name, color, visible, index}: ColumnProps) => {
<div className={classNames("column__header-text-wrapper", {"column__header-text-wrapper--hidden": !visible})}>
{!visible && <Hidden className="column__header-hidden-icon" title={t("Column.hiddenColumn")} onClick={toggleVisibilityHandler} />}
<h2
id={`column-${id}`}
onDoubleClick={() => {
if (isModerator) {
setColumnNameMode("EDIT");
Expand All @@ -102,6 +104,9 @@ export const Column = ({id, name, color, visible, index}: ColumnProps) => {
>
{name}
</h2>
<Tooltip className="column__tooltip" anchorSelect={`#column-${id}`}>
{name}
</Tooltip>
</div>
) : (
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ exports[`Column should have correct style show column with correct style 1`] = `
</svg>
<h2
class="column__header-text column__header-text--hidden"
id="column-test-columns-id-1"
>
Testheader 1
</h2>
Expand Down
24 changes: 1 addition & 23 deletions src/components/TooltipPortal/TooltipPortal.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
@import "src/constants/style";

$tooltip-max-width: 80%;

// tooltip
@mixin tooltip {
z-index: $tooltip-z-index;
border-radius: $rounded--large;
max-width: $tooltip-max-width;
font-size: $text--sm;
}

@mixin tooltip--light {
@include tooltip;
color: $color-black;
background-color: $hover-background-light;
}

@mixin tooltip--dark {
@include tooltip;
color: $color-white;
background-color: $hover-background-dark;
}
@import "constants/style";

// selecting .tooltip-portal directly won't work because of CSS specificity
.tooltip-portal__root .tooltip-portal {
Expand Down
20 changes: 20 additions & 0 deletions src/constants/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,23 @@ $column-stripes--dark: repeating-linear-gradient(
}
}
}

// tooltip
@mixin tooltip {
z-index: $tooltip-z-index;
border-radius: $rounded--large;
max-width: 80%;
font-size: $text--sm;
}

@mixin tooltip--light {
@include tooltip;
color: $color-black;
background-color: $hover-background-light;
}

@mixin tooltip--dark {
@include tooltip;
color: $color-white;
background-color: $hover-background-dark;
}
Loading