Skip to content

Commit aa9ffa9

Browse files
committed
styling/Change size of description
1 parent 2f9dd71 commit aa9ffa9

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

app/assets/stylesheets/snippets.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@
9393
}
9494

9595
&--description {
96-
font-family: Helvetica, sans-serif;
97-
font-size: 14px;
98-
color: darkslategrey;
96+
font-weight: 500;
9997
}
10098

10199
&--content {

app/javascript/controllers/highlight_controller.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Controller } from 'stimulus';
22
import marked from 'marked';
33

44
export default class extends Controller {
5-
static targets = ["code", "languages", "highlightedBody"];
5+
static targets = ["code", "languages", "highlightedBody", "description"];
66

77
connect() {
88
this.addLanguagesToSelect()
@@ -19,6 +19,10 @@ export default class extends Controller {
1919

2020
}
2121

22+
updateDescription(event) {
23+
this.descriptionTarget.innerHTML = event.target.value
24+
}
25+
2226
// TODO: Pass in the selected language!!!
2327
highlight(event) {
2428
const rawCode = event.currentTarget.value

app/views/snippets/_snippet.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
</div>
2020
</div>
21-
<p class="snippet--description"><%= snippet.description %></p>
21+
<h3 class="snippet--description"><%= snippet.description %></h3>
2222

2323
<%= render partial: 'shared/code_highlight', locals: { code: snippet.highlighted_body, language: snippet.language } %>
2424
</div>

app/views/snippets/_snippet_preview.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
</div>
2020
</div>
21-
<p class="snippet--description"><%= snippet.description %></p>
21+
<h3 class="snippet--description"><%= snippet.description %></h3>
2222

2323
<%= render partial: 'shared/code_highlight', locals: { code: snippet.highlighted_body, language: snippet.language, classes: 'snippet--content' } %>
2424
</div>

app/views/snippets/new.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
<div data-controller="highlight snippets">
1515
<div data-target="snippets.errors"></div>
1616
<%= form_for @snippet, remote: true, html: { data: { type: "html", action: "ajax:success->snippets#onCreateSuccess ajax:error->snippets#onCreateError" } } do |f| %>
17-
<%= f.text_field :description, { class: "new-snippet--description", placeholder: "Snippet description..." } %>
1817
<div class="tabs-details">
1918
<div data-target="tabs.panel">
19+
<%= f.text_field :description, { data: { action: "input->highlight#updateDescription" }, class: "new-snippet--description", placeholder: "Snippet description..." } %>
2020
<%= f.text_area :body, { data: { action: "input->highlight#highlight" }, id: "code-text-area", class: "new-snippet--body" } %>
2121
<%= f.text_area :highlighted_body, { data: { target: "highlight.highlightedBody" }, class: "hidden" } %>
2222
</div>
2323

2424
<div data-target="tabs.panel" class="hidden">
2525
<div class="new-snippet--preview">
26+
<h3 class="snippet--description" data-target="highlight.description"></h3>
2627
<div class="code-highlight" data-target="highlight.code"></div>
2728
</div>
2829
</div>

0 commit comments

Comments
 (0)