diff --git a/apps/desktop/src/lib/branch/ActiveBranchStatus.svelte b/apps/desktop/src/lib/branch/ActiveBranchStatus.svelte index 05084e82e..1ef8b8f82 100644 --- a/apps/desktop/src/lib/branch/ActiveBranchStatus.svelte +++ b/apps/desktop/src/lib/branch/ActiveBranchStatus.svelte @@ -47,7 +47,7 @@ icon="pr-small" style="success" kind="solid" - help="These changes have been integrated upstream, update your workspace to make this lane disappear." + tooltip="Changes have been integrated upstream, update your workspace to make this lane disappear." reversedDirection>Integrated {:else} @@ -56,7 +56,7 @@ size="tag" icon="virtual-branch-small" style="neutral" - help="These changes are in your working directory." + tooltip="Changes are in your working directory" reversedDirection>Virtual {/if} @@ -68,7 +68,7 @@ style="neutral" shrinkable disabled - help="Branch name that will be used when pushing. You can change it from the lane menu." + tooltip={'Branch name that will be used when pushing.\nChange it from the lane menu'} > {name} @@ -81,7 +81,7 @@ style="neutral" kind="solid" icon="remote-branch-small" - help="At least some of your changes have been pushed" + tooltip="Some changes have been pushed" reversedDirection>Remote @@ -214,7 +214,7 @@ + + {#if gitHostBranch} diff --git a/apps/desktop/src/lib/components/SyncButton.svelte b/apps/desktop/src/lib/components/SyncButton.svelte index 92f38275a..b61a3b2eb 100644 --- a/apps/desktop/src/lib/components/SyncButton.svelte +++ b/apps/desktop/src/lib/components/SyncButton.svelte @@ -24,7 +24,7 @@ style="ghost" outline icon="update-small" - help="Last fetch from upstream" + tooltip="Last fetch from upstream" {loading} onmousedown={async (e) => { e.preventDefault(); diff --git a/apps/desktop/src/lib/components/UpdateBaseButton.svelte b/apps/desktop/src/lib/components/UpdateBaseButton.svelte index 275e97ec4..6a99489cb 100644 --- a/apps/desktop/src/lib/components/UpdateBaseButton.svelte +++ b/apps/desktop/src/lib/components/UpdateBaseButton.svelte @@ -13,7 +13,7 @@ size="tag" style="error" kind="solid" - help="Merge upstream commits into common base" + tooltip="Merge upstream into common base" onclick={async () => { loading = true; try { diff --git a/apps/desktop/src/lib/file/FileCardHeader.svelte b/apps/desktop/src/lib/file/FileCardHeader.svelte index 19465b336..1a219f2bf 100644 --- a/apps/desktop/src/lib/file/FileCardHeader.svelte +++ b/apps/desktop/src/lib/file/FileCardHeader.svelte @@ -35,7 +35,7 @@ clickable={false} icon="locked-small" style="warning" - help="File changes cannot be moved because part of this file was already committed into this branch" + tooltip="File changes cannot be moved because part of this file was already committed into this branch" >Locked {/if} diff --git a/apps/desktop/src/lib/file/FileDiff.svelte b/apps/desktop/src/lib/file/FileDiff.svelte index 76b79bf98..1b2112773 100644 --- a/apps/desktop/src/lib/file/FileDiff.svelte +++ b/apps/desktop/src/lib/file/FileDiff.svelte @@ -5,7 +5,7 @@ import { getLocalCommits, getLocalAndRemoteCommits } from '$lib/vbranches/contexts'; import { getLockText } from '$lib/vbranches/tooltip'; import Icon from '@gitbutler/ui/Icon.svelte'; - import { tooltip } from '@gitbutler/ui/utils/tooltip'; + import Tooltip from '@gitbutler/ui/Tooltip.svelte'; import type { HunkSection, ContentSection } from '$lib/utils/fileSections'; interface Props { @@ -76,14 +76,9 @@ {#if section.hunk.lockedTo && section.hunk.lockedTo.length > 0 && commits} -
+ -
+ {/if} {#if section.hunk.poisoned} Can not manage this hunk because it depends on changes from multiple branches diff --git a/apps/desktop/src/lib/history/SnapshotCard.svelte b/apps/desktop/src/lib/history/SnapshotCard.svelte index 03e7734cf..1f0308537 100644 --- a/apps/desktop/src/lib/history/SnapshotCard.svelte +++ b/apps/desktop/src/lib/history/SnapshotCard.svelte @@ -172,7 +172,7 @@ size="tag" style="ghost" outline - help="Restores GitButler and your files to the state before this operation. Revert actions can also be undone." + tooltip="Restores GitButler and your files to the state before this operation. Revert actions can also be undone." onclick={() => { dispatch('restoreClick'); }} diff --git a/apps/desktop/src/lib/navigation/DomainButton.svelte b/apps/desktop/src/lib/navigation/DomainButton.svelte index 6c76f824b..5923e4b0b 100644 --- a/apps/desktop/src/lib/navigation/DomainButton.svelte +++ b/apps/desktop/src/lib/navigation/DomainButton.svelte @@ -1,5 +1,5 @@ - + + + diff --git a/packages/ui/src/lib/avatar/Avatar.svelte b/packages/ui/src/lib/avatar/Avatar.svelte index 91e5aa796..1a9b17310 100644 --- a/packages/ui/src/lib/avatar/Avatar.svelte +++ b/packages/ui/src/lib/avatar/Avatar.svelte @@ -1,6 +1,6 @@ -
- {tooltip} (isLoaded = true)} - class:show={isLoaded} - use:tooltipComponent={{ - text: tooltip, - delay: 500 - }} - /> -
+ +
+ {tooltip} (isLoaded = true)} + class:show={isLoaded} + /> +
+
diff --git a/packages/ui/src/stories/tooltip/Tooltip.stories.ts b/packages/ui/src/stories/tooltip/Tooltip.stories.ts new file mode 100644 index 000000000..06680219c --- /dev/null +++ b/packages/ui/src/stories/tooltip/Tooltip.stories.ts @@ -0,0 +1,30 @@ +import DemoTooltip from './DemoTooltip.svelte'; +import type { Meta, StoryObj } from '@storybook/svelte'; + +const meta = { + title: 'Overlays / Tooltip', + component: DemoTooltip +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const DefaultStory: Story = { + name: 'Tooltip', + args: { + position: 'bottom', + align: 'center', + delay: 500, + text: 'This is a fantastic tooltip :D' + }, + argTypes: { + position: { + control: 'select', + options: ['top', 'bottom'] + }, + align: { + control: 'select', + options: ['start', 'center', 'end'] + } + } +}; diff --git a/packages/ui/src/styles/components/tooltip.css b/packages/ui/src/styles/components/tooltip.css deleted file mode 100644 index dee438feb..000000000 --- a/packages/ui/src/styles/components/tooltip.css +++ /dev/null @@ -1,33 +0,0 @@ -.tooltip { - pointer-events: none; - background-color: var(--clr-core-ntrl-10); - border-radius: var(--radius-s); - border: 1px solid var(--clr-core-ntrl-30); - color: var(--clr-core-ntrl-60); - display: inline-block; - padding: 6px 8px; - z-index: var(--z-blocker); - - max-width: 180px; - position: absolute; - left: -9999px; - top: -9999px; - - opacity: 0; - animation: showup-tooltip-animation 0.1s ease-out forwards; - - &.no-max-width { - max-width: unset; - } -} - -@keyframes showup-tooltip-animation { - from { - opacity: 0; - transform: translateY(-0.2rem) scale(0.9); - } - to { - opacity: 1; - transform: translateY(0) scale(1); - } -} diff --git a/packages/ui/src/styles/core/design-tokens.css b/packages/ui/src/styles/core/design-tokens.css index 1b924025f..68e5167ce 100644 --- a/packages/ui/src/styles/core/design-tokens.css +++ b/packages/ui/src/styles/core/design-tokens.css @@ -52,13 +52,13 @@ --clr-core-succ-5: color(srgb 0.050980392156862744 0.14901960784313725 0.10196078431372549); --clr-core-succ-10: color(srgb 0.10980392156862745 0.25098039215686274 0.1843137254901961); --clr-core-succ-20: color(srgb 0.13333333333333333 0.3254901960784314 0.23529411764705882); - --clr-core-succ-30: color(srgb 0.16470588235294117 0.49411764705882355 0.3411764705882353); - --clr-core-succ-40: color(srgb 0.27450980392156865 0.6078431372549019 0.45098039215686275); - --clr-core-succ-50: color(srgb 0.3058823529411765 0.6941176470588235 0.5098039215686274); - --clr-core-succ-60: color(srgb 0.6313725490196078 0.807843137254902 0.7254901960784313); - --clr-core-succ-70: color(srgb 0.792156862745098 0.9098039215686274 0.8549019607843137); - --clr-core-succ-80: color(srgb 0.8392156862745098 0.9411764705882353 0.8941176470588236); - --clr-core-succ-90: color(srgb 0.9098039215686274 0.9686274509803922 0.9411764705882353); + --clr-core-succ-30: color(srgb 0.1568627450980392 0.4823529411764706 0.3333333333333333); + --clr-core-succ-40: color(srgb 0.23529411764705882 0.6039215686274509 0.43529411764705883); + --clr-core-succ-50: color(srgb 0.2901960784313726 0.7098039215686275 0.5098039215686274); + --clr-core-succ-60: color(srgb 0.5725490196078431 0.8666666666666667 0.7294117647058823); + --clr-core-succ-70: color(srgb 0.7450980392156863 0.9568627450980393 0.8549019607843137); + --clr-core-succ-80: color(srgb 0.8156862745098039 0.9686274509803922 0.8980392156862745); + --clr-core-succ-90: color(srgb 0.8980392156862745 0.9803921568627451 0.9411764705882353); --clr-core-succ-95: color(srgb 0.9647058823529412 0.9882352941176471 0.984313725490196); --clr-core-purp-5: color(srgb 0.1568627450980392 0.11372549019607843 0.26666666666666666); --clr-core-purp-10: color(srgb 0.24705882352941178 0.17254901960784313 0.40784313725490196); @@ -235,6 +235,8 @@ srgb 0.5294117647058824 0.6588235294117647 0.6039215686274509 ); --clr-diff-addition-line-bg: color(srgb 0.8784313725490196 0.984313725490196 0.9411764705882353); + --clr-tooltip-border: var(--clr-core-ntrl-10); + --clr-tooltip-bg: var(--clr-core-ntrl-10); --size-icon: 1rem; --size-tag: 1.375rem; --size-button: 1.75rem; @@ -419,6 +421,8 @@ --clr-diff-addition-line-bg: color( srgb 0.054901960784313725 0.1843137254901961 0.1450980392156863 ); + --clr-tooltip-border: var(--clr-core-ntrl-30); + --clr-tooltip-bg: var(--clr-core-ntrl-10); } .bg-clr1 { diff --git a/packages/ui/src/styles/main.css b/packages/ui/src/styles/main.css index 563de01fc..ac23d4f29 100644 --- a/packages/ui/src/styles/main.css +++ b/packages/ui/src/styles/main.css @@ -14,7 +14,6 @@ /* COMPONENTS */ @import './components/diff.css'; -@import './components/tooltip.css'; @import './components/text-input.css'; @import './components/commit-lines.css'; @import './components/draggable.css'; diff --git a/packages/ui/terrazzo.config.js b/packages/ui/terrazzo.config.js index 68fa25a3e..c575df4e0 100644 --- a/packages/ui/terrazzo.config.js +++ b/packages/ui/terrazzo.config.js @@ -14,7 +14,7 @@ function clearFxPrefix(id) { } export default defineConfig({ - tokens: './src/lib/design-tokens.json', + tokens: './src/lib/data/design-tokens.json', outDir: './src/styles/core', plugins: [ css({