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: created seperate class for permenant tooltip #263

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
2 changes: 1 addition & 1 deletion src/visualBuilder/components/fieldLabelWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function FieldLabelWrapperComponent(
icon: fieldDisabled ? (
<div
className={classNames(
visualBuilderStyles()["visual-builder__tooltip"]
visualBuilderStyles()["visual-builder__tooltip--persistent"]
)}
data-tooltip={reason}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("appendFieldPathDropdown", () => {
});

test("should not do anything if tooltip is already present", () => {
focusedToolbar.classList.add("visual-builder__tooltip");
focusedToolbar.classList.add("visual-builder__tooltip--persistent");

appendFieldPathDropdown(mockEventDetails, focusedToolbar);

Expand Down
94 changes: 56 additions & 38 deletions src/visualBuilder/visualBuilder.style.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
import { css } from "goober";


const tooltipBaseStyle = `
pointer-events: all;
svg {
pointer-events: none;
}
&:before {
content: attr(data-tooltip);
position: absolute;
bottom: 20px;
margin-bottom: 16px;
padding: 12px;
border-radius: 4px;
width: max-content;
max-width: 200px;
color: #fff;
font-family: Inter;
font-size: 0.75rem;
font-style: normal;
font-weight: 400;
line-height: 132%; /* 0.99rem */
letter-spacing: 0.015rem;
background: #767676;
}
&:after {
content: "";
position: absolute;
bottom: 17px;
/* the arrow */
border: 10px solid #000;
border-color: #767676 transparent transparent transparent;
}
`;


export function visualBuilderStyles() {
return {
"visual-builder__container": css`
Expand Down Expand Up @@ -381,50 +416,33 @@ export function visualBuilderStyles() {
}
`,
"visual-builder__tooltip": css`
pointer-events: all;

svg {
pointer-events: none;
}
${tooltipBaseStyle}

&:before {
content: attr(data-tooltip);
position: absolute;

bottom: 20px;
margin-bottom: 16px;

padding: 12px;
border-radius: 4px;

width: max-content;
max-width: 200px;
display: block;
&:before {
display: none;
}

color: #fff;
background: #909090;
font-family: Inter;
font-size: 0.75rem;
font-style: normal;
font-weight: 400;
line-height: 132%; /* 0.99rem */
letter-spacing: 0.015rem;
text-align: left;
}
&:hover:before,
&:hover:after {
display: block;
}

&:after {
content: "";
position: absolute;
&:after {
display: none;
}
`,

bottom: 17px;
"visual-builder__tooltip--persistent": css`
${tooltipBaseStyle}

/* the arrow */
border: 10px solid #000;
border-color: #909090 transparent transparent transparent;
&:before {
display: block;
}

display: block;
}
`,
&:after {
display: block;
}
`,
"visual-builder__empty-block": css`
width: 100%;
height: 100%;
Expand Down
Loading