From cd004e9c534bfd95f5b01321889a8a12ea05648a Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Sun, 15 Oct 2023 07:50:22 +0300 Subject: [PATCH] Infra to new code highlight --- assets/styles/layout/_code.scss | 19 ++---------------- assets/styles/layout/_doc.scss | 33 ++++++++++++++++++++++++------- components/doc/DocSectionCode.vue | 11 +++-------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/assets/styles/layout/_code.scss b/assets/styles/layout/_code.scss index 9ba17b8fd..450ebdf09 100644 --- a/assets/styles/layout/_code.scss +++ b/assets/styles/layout/_code.scss @@ -26,8 +26,9 @@ pre[class*="language-"] { position: relative; background: transparent; margin: 0; - overflow: visible; padding: 0; + max-height: 40rem; + overflow: auto; &:before, &:after { display: none !important; @@ -128,22 +129,6 @@ pre[class*="language-"] { display: none; } -.doc-section-code-buttons { - button { - outline: 0 none; - outline-offset: 0; - background-color: transparent; - transition: background-color .2s, box-shadow .2s; - border: 0 none; - color: var(--demo-code-button-color); - cursor: pointer; - - &:hover { - background-color: var(--demo-code-button-hover-bg); - color: var(--demo-code-button-hover-color); - } - } -} pre[class*="language-"] { code { background: var(--demo-code-bg) !important; diff --git a/assets/styles/layout/_doc.scss b/assets/styles/layout/_doc.scss index ca7645c96..bf773bdfc 100644 --- a/assets/styles/layout/_doc.scss +++ b/assets/styles/layout/_doc.scss @@ -194,14 +194,30 @@ } } -.doc-section-code-buttons { - gap: .75rem; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - .p-button-label { - font-weight: normal; - font-size: 0.875rem; +.doc-section-code-buttons { + position: absolute; + display: flex; + align-items: center; + justify-content: end; + z-index: 1; + top: .75rem; + right: .75rem; + gap: .75rem; + + button { + outline: 0 none; + outline-offset: 0; + background-color: transparent; + transition: background-color .2s, box-shadow .2s; + border: 0 none; + color: var(--demo-code-button-color); + cursor: pointer; + + &:hover { + background-color: var(--demo-code-button-hover-bg); + color: var(--demo-code-button-hover-color); + } } } @@ -211,6 +227,8 @@ } .doc-section-code { + position: relative; + div { &::-webkit-scrollbar { width: 5px; @@ -254,6 +272,7 @@ &:first-child { color: var(--primary-color); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, Liberation Mono, monospace; + font-weight: 600; } .doc-option-type { diff --git a/components/doc/DocSectionCode.vue b/components/doc/DocSectionCode.vue index 33f88909b..989ee9323 100644 --- a/components/doc/DocSectionCode.vue +++ b/components/doc/DocSectionCode.vue @@ -1,10 +1,6 @@