Skip to content

Commit

Permalink
Minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
endigo9740 committed May 3, 2024
1 parent 5a12035 commit 5a2f4a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/app.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ html.dark .shiki span {

/* Utility Classes */

/* Tooltip */
.tooltip {
@apply bg-surface-500 text-white p-4 rounded;
/* Floating */
.floating {
/* Floating UI Requirements */
@apply w-max absolute top-0 left-0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/FloatingArrow/FloatingArrow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { FloatingArrowProps } from './types.js';
let {
arrowRef = $bindable(null),
ref = $bindable(null),
context,
// ---
width = 14,
Expand Down Expand Up @@ -66,7 +66,7 @@
</script>

<svg
bind:this={arrowRef}
bind:this={ref}
width={isCustomShape ? width : width + computedStrokeWidth}
height={width}
viewBox={`0 0 ${width} ${height > width ? height : width}`}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/FloatingArrow/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface FloatingArrowProps {
* The binded HTML element reference.
* @default null
* */
arrowRef: Element | null;
ref: Element | null;
// Context Source: https://github.com/floating-ui/floating-ui/blob/master/packages/react/src/types.ts#L132
/** The floating context. */
context: FloatingContext;
Expand Down
10 changes: 7 additions & 3 deletions src/routes/context-menus/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
<div class="space-y-10">
<section>
<button bind:this={elements.reference} class="btn-rose-sm">Reference</button>
<div bind:this={elements.floating} style={floating.floatingStyles} class="tooltip">
<div>Floating</div>
<FloatingArrow bind:arrowRef context={floating.context} classes="fill-surface-500" />
<div
bind:this={elements.floating}
style={floating.floatingStyles}
class="floating bg-surface-500 text-white p-4 rounded"
>
<p>Floating</p>
<FloatingArrow bind:ref={arrowRef} context={floating.context} classes="fill-surface-500" />
</div>
</section>
</div>

0 comments on commit 5a2f4a0

Please sign in to comment.