Skip to content

Commit 7e11933

Browse files
committed
Update snippet html & css for consistency between edit and show
1 parent e4c332b commit 7e11933

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

app/javascript/css/components/snippet.css

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.snippet {
2-
filter: drop-shadow(0 0 0.75rem var(--joy-color-50));
2+
filter: drop-shadow(0.25rem 0.5rem 0.75rem var(--joy-color-500));
33
width: fit-content;
44
max-width: var(--grid-max-width) - (2 * var(--grid-gutter));
55

@@ -9,10 +9,20 @@
99
padding-bottom: var(--space-m);
1010
padding-inline-start: var(--space-m);
1111
}
12+
13+
& .clipboard-copy-container {
14+
position: absolute;
15+
right: 0px;
16+
display: none;
17+
}
18+
19+
&:hover .clipboard-copy-container {
20+
display: block;
21+
}
1222
}
1323

1424
.snippet-background {
15-
background-color: var(--joy-color-200);
25+
background: linear-gradient(var(--joy-color-300), var(--joy-color-200));
1626
padding: var(--space-l);
1727
width: fit-content;
1828
aspect-ratio: 2 / 1;

app/views/components/code_block/snippet.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def initialize(snippet, screenshot: false, **options)
1313

1414
def view_template
1515
div(class: "snippet-background", **options) do
16-
render CodeBlock::Container.new(language: language) do
16+
render CodeBlock::Container.new(language: language, class: "snippet") do
1717
render CodeBlock::Header.new { title_content } if title_content.present?
1818

1919
render CodeBlock::Body.new do

app/views/share/snippets/form.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize(snippet)
1515

1616
def view_template
1717
turbo_stream.update "flash", partial: "application/flash"
18-
div(class: "section-content") do
18+
div do
1919
form_with(
2020
model: [:share, snippet],
2121
class: "section-content",

0 commit comments

Comments
 (0)