mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-24 18:59:17 +00:00
Tooltip and cursor enhancements for the left panel separator (#34643)
* Show tooltip when mouse is anywhere on the separator * Show correct cursor * Fix tests * Put tooltip inside separator container * Update tests * Fix hand icon not appearing
This commit is contained in:
@@ -15,6 +15,14 @@
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* When type=border, we just render a 1px border */
|
||||
@@ -86,3 +94,8 @@
|
||||
transition: border 0.15s ease-in-out 0.3s;
|
||||
}
|
||||
}
|
||||
|
||||
.dragIcon {
|
||||
/* The important declaration is required to override the icon set by the library */
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
@@ -60,15 +60,18 @@ export function SeparatorView({ vm, className }: Props): React.ReactNode {
|
||||
const type = isCollapsed ? "bar" : "border";
|
||||
|
||||
const barContent = (
|
||||
<Tooltip description={_t("left_panel|separator_label")} placement="right">
|
||||
<DragIcon
|
||||
width="20px"
|
||||
height="12px"
|
||||
// Without a custom view-box, this svg would scale incorrectly and would appear tiny within the separator.
|
||||
// See https://github.com/element-hq/compound/issues/242
|
||||
viewBox="3.999704360961914 8.999704360961914 16.000295639038086 6.000591278076172"
|
||||
transform="rotate(90)"
|
||||
/>
|
||||
<Tooltip description={_t("left_panel|separator_label")} placement="right" disabled={type === "border"}>
|
||||
<div className={styles.content}>
|
||||
<DragIcon
|
||||
className={styles.dragIcon}
|
||||
width="20px"
|
||||
height="12px"
|
||||
// Without a custom view-box, this svg would scale incorrectly and would appear tiny within the separator.
|
||||
// See https://github.com/element-hq/compound/issues/242
|
||||
viewBox="3.999704360961914 8.999704360961914 16.000295639038086 6.000591278076172"
|
||||
transform="rotate(90)"
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
|
||||
+32
-22
@@ -45,18 +45,23 @@ exports[`<SeparatorView /> > renders Default story 1`] = `
|
||||
style="flex: 0 0 auto; touch-action: none;"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="12px"
|
||||
transform="rotate(90)"
|
||||
viewBox="3.999704360961914 8.999704360961914 16.000295639038086 6.000591278076172"
|
||||
width="20px"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
<div
|
||||
class="SeparatorView-module_content"
|
||||
>
|
||||
<path
|
||||
d="M5 15a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 14q0-.424.287-.713A.97.97 0 0 1 5 13h14q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 19 15zm0-4a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 10q0-.424.287-.713A.97.97 0 0 1 5 9h14q.424 0 .712.287Q20 9.576 20 10t-.288.713A.97.97 0 0 1 19 11z"
|
||||
/>
|
||||
</svg>
|
||||
<svg
|
||||
class="SeparatorView-module_dragIcon"
|
||||
fill="currentColor"
|
||||
height="12px"
|
||||
transform="rotate(90)"
|
||||
viewBox="3.999704360961914 8.999704360961914 16.000295639038086 6.000591278076172"
|
||||
width="20px"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M5 15a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 14q0-.424.287-.713A.97.97 0 0 1 5 13h14q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 19 15zm0-4a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 10q0-.424.287-.713A.97.97 0 0 1 5 9h14q.424 0 .712.287Q20 9.576 20 10t-.288.713A.97.97 0 0 1 19 11z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-panel="true"
|
||||
@@ -125,18 +130,23 @@ exports[`<SeparatorView /> > renders HoverWhenCollapsed story 1`] = `
|
||||
style="flex: 0 0 auto; touch-action: none;"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="12px"
|
||||
transform="rotate(90)"
|
||||
viewBox="3.999704360961914 8.999704360961914 16.000295639038086 6.000591278076172"
|
||||
width="20px"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
<div
|
||||
class="SeparatorView-module_content"
|
||||
>
|
||||
<path
|
||||
d="M5 15a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 14q0-.424.287-.713A.97.97 0 0 1 5 13h14q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 19 15zm0-4a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 10q0-.424.287-.713A.97.97 0 0 1 5 9h14q.424 0 .712.287Q20 9.576 20 10t-.288.713A.97.97 0 0 1 19 11z"
|
||||
/>
|
||||
</svg>
|
||||
<svg
|
||||
class="SeparatorView-module_dragIcon"
|
||||
fill="currentColor"
|
||||
height="12px"
|
||||
transform="rotate(90)"
|
||||
viewBox="3.999704360961914 8.999704360961914 16.000295639038086 6.000591278076172"
|
||||
width="20px"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M5 15a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 14q0-.424.287-.713A.97.97 0 0 1 5 13h14q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 19 15zm0-4a.97.97 0 0 1-.713-.287A.97.97 0 0 1 4 10q0-.424.287-.713A.97.97 0 0 1 5 9h14q.424 0 .712.287Q20 9.576 20 10t-.288.713A.97.97 0 0 1 19 11z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-panel="true"
|
||||
|
||||
Reference in New Issue
Block a user