Skip to content

Commit

Permalink
Eliminate popoverWidth property
Browse files Browse the repository at this point in the history
Users of `Popover` can set the width by setting it on the slot element.

Signed-off-by: Thomas Scholtes <[email protected]>
  • Loading branch information
geigerzaehler committed Nov 7, 2023
1 parent bee31bb commit 2d97d85
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 24 deletions.
9 changes: 4 additions & 5 deletions src/App/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,15 @@
for keyboard shortcuts
</div>
<div class="right">
<Popover
popoverPositionBottom="2rem"
popoverPositionRight="0"
popoverWidth="21rem">
<Popover popoverPositionBottom="2rem" popoverPositionRight="0">
<IconButton slot="toggle" let:toggle on:click={toggle}>
<IconSmall name="brush" />
Theme
</IconButton>

<ThemeSettings slot="popover" />
<div slot="popover" style:width="19rem">
<ThemeSettings />
</div>
</Popover>

<a
Expand Down
6 changes: 2 additions & 4 deletions src/App/Header/Connect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
display: flex;
flex-direction: column;
gap: 1.5rem;
width: "23rem";
}
.host {
display: flex;
Expand Down Expand Up @@ -78,10 +79,7 @@
</style>

{#if $httpdStore.state === "authenticated"}
<Popover
popoverPositionTop="3rem"
popoverPositionRight="0"
popoverWidth="25rem">
<Popover popoverPositionTop="3rem" popoverPositionRight="0">
<Button
slot="toggle"
let:toggle
Expand Down
4 changes: 1 addition & 3 deletions src/components/Popover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
export let popoverPositionLeft: string | undefined = undefined;
export let popoverPositionRight: string | undefined = undefined;
export let popoverPositionTop: string | undefined = undefined;
export let popoverWidth: string | undefined = undefined;
let expanded = false;
let thisComponent: HTMLDivElement;
Expand Down Expand Up @@ -62,8 +61,7 @@
style:right={popoverPositionRight}
style:top={popoverPositionTop}
style:padding={popoverPadding}
style:border-radius={popoverBorderRadius}
style:width={popoverWidth}>
style:border-radius={popoverBorderRadius}>
<slot name="popover" />
</div>
{/if}
Expand Down
9 changes: 3 additions & 6 deletions src/views/projects/Header/CloneButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
}
</style>

<Popover
popoverPositionTop="3rem"
popoverPositionRight="0"
popoverWidth="26rem">
<Popover popoverPositionTop="3rem" popoverPositionRight="0">
<Button
slot="toggle"
let:toggle
Expand All @@ -47,7 +44,7 @@
<Icon name="download" />
</Button>

<svelte:fragment slot="popover">
<div slot="popover" style:width="24rem">
<div style:margin-bottom="1.5rem">
<label for="rad-clone-url">
Use the <a
Expand All @@ -66,5 +63,5 @@
<label for="git-clone-url">Use Git to clone this repository.</label>
<Command command={gitCloneUrl} />
</div>
</svelte:fragment>
</div>
</Popover>
9 changes: 3 additions & 6 deletions src/views/projects/Header/TrackButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
}
</style>

<Popover
popoverPositionTop="3rem"
popoverPositionRight="0"
popoverWidth="33rem">
<Popover popoverPositionTop="3rem" popoverPositionRight="0">
<Button
slot="toggle"
let:toggle
Expand All @@ -56,7 +53,7 @@
</span>
</Button>

<svelte:fragment slot="popover">
<div slot="popover" style:width="31rem">
<div class="track-label">
Use the <a
target="_blank"
Expand Down Expand Up @@ -84,5 +81,5 @@
{/if}
</div>
<Command command={`rad ${command} ${projectId}`} />
</svelte:fragment>
</div>
</Popover>

0 comments on commit 2d97d85

Please sign in to comment.