Skip to content

Commit

Permalink
Fix overlap of copy button on CodeBlock component (#2470)
Browse files Browse the repository at this point in the history
* Add margin if copyable button is visible

* Fix text color in current details
  • Loading branch information
laurakwhit authored Dec 11, 2024
1 parent c1117f3 commit f4425b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/holocene/code-block.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
): EditorState => {
const extensions = [
keymap.of([...standardKeymap, ...historyKeymap]),
TEMPORAL_THEME(isDark),
TEMPORAL_THEME({ isDark, copyable }),
syntaxHighlighting(TEMPORAL_SYNTAX, { fallback: true }),
indentUnit.of(' '),
closeBrackets(),
Expand Down Expand Up @@ -202,7 +202,7 @@
<CopyButton
{copyIconTitle}
{copySuccessIconTitle}
class="absolute right-3 top-1 text-secondary"
class="absolute right-1 top-1 text-secondary"
on:click={handleCopy}
copied={$copied}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/layouts/workflow-header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
>
<Icon
name="flag"
class="text-indigo-600/80"
class="text-brand"
width={32}
height={32}
/>{translate('workflows.current-details')}
Expand Down
9 changes: 8 additions & 1 deletion src/lib/vendor/codemirror/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import colors from 'tailwindcss/colors';

import { css } from '$lib/theme/utilities';

export const TEMPORAL_THEME = (isDark) =>
export const TEMPORAL_THEME = ({
isDark,
copyable,
}: {
isDark: boolean;
copyable: boolean;
}) =>
EditorView.theme(
{
'&': {
Expand All @@ -22,6 +28,7 @@ export const TEMPORAL_THEME = (isDark) =>
'.cm-content': {
caretColor: css('--color-text-primary'),
fontSize: '0.875em',
...(copyable && { marginRight: '1.75rem' }),
},
'.cm-editor&.cm-focused': {
outline: `3px solid ${colors.indigo['600']}`,
Expand Down

0 comments on commit f4425b3

Please sign in to comment.