[web] Add button style for copy to clipboard component

GitOrigin-RevId: e387f79c829c903660638d3781839c44da10db07
This commit is contained in:
Domagoj Kriskovic
2026-02-19 09:05:37 +00:00
committed by Copybot
parent 0d71cc18fd
commit 4603722288
3 changed files with 29 additions and 2 deletions
@@ -313,7 +313,7 @@ function AccessToken({
return (
<div className="access-token">
<code>{link}</code>
<CopyToClipboard content={link} tooltipId={tooltipId} />
<CopyToClipboard content={link} tooltipId={tooltipId} kind="button" />
</div>
)
}
@@ -3,11 +3,12 @@ import { useTranslation } from 'react-i18next'
import OLButton from '@/shared/components/ol/ol-button'
import OLTooltip from '@/shared/components/ol/ol-tooltip'
import OLIconButton from '@/shared/components/ol/ol-icon-button'
import MaterialIcon from '@/shared/components/material-icon'
export const CopyToClipboard = memo<{
content: string
tooltipId: string
kind?: 'text' | 'icon'
kind?: 'text' | 'icon' | 'button'
unfilled?: boolean
onClick?: () => void
}>(({ content, tooltipId, kind = 'icon', unfilled = false, onClick }) => {
@@ -46,6 +47,20 @@ export const CopyToClipboard = memo<{
>
{t('copy')}
</OLButton>
) : kind === 'button' ? (
<OLButton
onClick={handleClick}
size="sm"
variant="ghost"
className="copy-button copy-button-ghost"
>
{copied ? (
<MaterialIcon type="check" />
) : (
<MaterialIcon type="content_copy" unfilled />
)}
{t('copy')}
</OLButton>
) : (
<OLIconButton
onClick={handleClick}
@@ -369,6 +369,18 @@ a.btn:visited {
text-decoration: none;
}
.copy-button.copy-button-ghost {
@include ol-button-variant(
$color: var(--content-primary),
$background: transparent,
$hover-background: var(--bg-light-tertiary)
);
.button-content {
gap: var(--spacing-02);
}
}
.btn-reset {
@include reset-button;
}