Skip to content

Commit

Permalink
Consistent approach and less ugly code imo
Browse files Browse the repository at this point in the history
  • Loading branch information
louismaximepiton committed Oct 2, 2024
1 parent a1732b9 commit 299da6f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
4 changes: 4 additions & 0 deletions site/assets/scss/_component-examples.scss
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@
}

.bd-file-ref {
position: relative;

.highlight-toolbar {
min-height: $spacer * 2.5;

@include media-breakpoint-up(md) {
@include border-top-radius(calc(var(--bs-border-radius) - 1px));
}
Expand Down
20 changes: 10 additions & 10 deletions site/layouts/shortcodes/js-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
{{- end -}}

<div class="bd-example-snippet bd-code-snippet bd-file-ref">
<a class="position-absolute ms-3 mt-2 py-1 font-monospace link-body-emphasis link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
{{- $file -}}
</a>
<!-- Boosted mod: added `.border-1` and `.border-subtle` -->
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom border-1 border-subtle">
<a class="me-5 font-monospace link-body-emphasis link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
{{- $file -}}
</a>
</div>

{{- $unindent := 0 -}}
{{- $found := false -}}
Expand All @@ -60,13 +63,10 @@
{{- end -}}
{{- highlight $output "js" "" -}}

<!-- Boosted mod: added `.border-1` and `.border-subtle` -->
<div class="d-flex order-first align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom border-1 border-subtle">
<div class="d-flex ms-auto">
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
</button>
</div>
<div class="position-absolute top-0 mt-1 end-0 me-2">
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
</button>
</div>
</div>
{{- end -}}
22 changes: 12 additions & 10 deletions site/layouts/shortcodes/scss-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
{{- end -}}

<div class="bd-example-snippet bd-code-snippet bd-file-ref">
<!-- Boosted mod: added `.border-1` and `.border-subtle` -->
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom border-1 border-subtle">
<a class="me-5 font-monospace link-body-emphasis link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
{{- $file -}}
</a>
</div>

{{- $unindent := 0 -}}
{{- $found := false -}}
{{- $first_line:= index (split $match "\n") 0 -}}
Expand All @@ -68,16 +75,11 @@
{{- $output = $match -}}
{{- end -}}
{{- highlight $output "scss" "" -}}
<!-- Boosted mod: added `.border-1` and `.border-subtle` -->
<div class="d-flex order-first align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom border-1 border-subtle">
<a class="font-monospace link-body-emphasis link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
{{- $file -}}
</a>
<div class="d-flex ms-auto">
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
</button>
</div>

<div class="position-absolute top-0 mt-1 end-0 me-2">
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
</button>
</div>
</div>
{{- end -}}

0 comments on commit 299da6f

Please sign in to comment.