-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make copyable UI similar to copy button in CodeBlock * Fix truncation in links without icons * Update snap * Create CopyButton component
- Loading branch information
1 parent
bf59034
commit d90815b
Showing
15 changed files
with
113 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/lib/components/workflow/first-previous-next-workflow-table.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script lang="ts"> | ||
import type { HTMLButtonAttributes } from 'svelte/elements'; | ||
import Icon from '$lib/holocene/icon/icon.svelte'; | ||
interface $$Props extends HTMLButtonAttributes { | ||
copyIconTitle: string; | ||
copySuccessIconTitle: string; | ||
copied: boolean; | ||
'data-testid'?: string; | ||
} | ||
export let copyIconTitle: string; | ||
export let copySuccessIconTitle: string; | ||
export let copied: boolean; | ||
let className = ''; | ||
export { className as class }; | ||
</script> | ||
|
||
<button class="copy-button {className}" on:click {...$$restProps}> | ||
<Icon | ||
title={copied ? copySuccessIconTitle : copyIconTitle} | ||
name={copied ? 'checkmark' : 'copy'} | ||
/> | ||
</button> | ||
|
||
<style lang="postcss"> | ||
.copy-button { | ||
@apply m-1 rounded-md border-2 border-[transparent] hover:border-indigo-600 hover:bg-gradient-to-br hover:from-blue-100 hover:to-purple-100 hover:shadow-focus hover:shadow-blue-600/50 focus-visible:border-indigo-600 focus-visible:bg-gradient-to-br focus-visible:from-blue-100 focus-visible:to-purple-100 focus-visible:shadow-focus focus-visible:shadow-blue-600/50 focus-visible:outline-none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script lang="ts"> | ||
import { copyToClipboard } from '$lib/utilities/copy-to-clipboard'; | ||
import CopyButton from './button.svelte'; | ||
export let content: string; | ||
export let visible = false; | ||
export let clickAllToCopy = false; | ||
export let copyIconTitle: string; | ||
export let copySuccessIconTitle: string; | ||
const { copy, copied } = copyToClipboard(); | ||
function handleOnClick(e: Event) { | ||
copy(e, content); | ||
} | ||
</script> | ||
|
||
{#if clickAllToCopy} | ||
<button | ||
class="group flex items-center gap-1 {$$props['container-class']}" | ||
on:click={handleOnClick} | ||
> | ||
<slot> | ||
<span class={$$props.class} class:select-all={!$$slots.default} | ||
>{content}</span | ||
> | ||
</slot> | ||
<CopyButton | ||
{copyIconTitle} | ||
{copySuccessIconTitle} | ||
class={visible ? 'visible' : 'invisible group-hover:visible'} | ||
on:click={handleOnClick} | ||
copied={$copied} | ||
/> | ||
</button> | ||
{:else} | ||
<div class="group flex items-center gap-1 {$$props['container-class']}"> | ||
<slot> | ||
<span class={$$props.class} class:select-all={!$$slots.default} | ||
>{content}</span | ||
> | ||
</slot> | ||
<CopyButton | ||
{copyIconTitle} | ||
{copySuccessIconTitle} | ||
class={visible ? 'visible' : 'invisible group-hover:visible'} | ||
on:click={handleOnClick} | ||
copied={$copied} | ||
/> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters