From 0a416e0545318706cb4fe1b85c4eb71ca2ff105a Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Sun, 15 Oct 2023 09:00:52 +0300 Subject: [PATCH] Introduced new code display --- assets/styles/layout/_code.scss | 6 +-- assets/styles/layout/_doc.scss | 80 +++++++++++++++++----------- components/doc/DocSectionCode.vue | 37 +++++-------- doc/checkbox/AccessibilityDoc.vue | 3 +- doc/checkbox/BasicDoc.vue | 9 ++-- doc/checkbox/DisabledDoc.vue | 9 ++-- doc/checkbox/DynamicDoc.vue | 9 ++-- doc/checkbox/GroupDoc.vue | 9 ++-- doc/checkbox/InvalidDoc.vue | 9 ++-- doc/checkbox/form/VeeValidateDoc.vue | 6 ++- doc/checkbox/pt/PTDoc.vue | 9 ++-- doc/checkbox/theming/TailwindDoc.vue | 6 ++- 12 files changed, 109 insertions(+), 83 deletions(-) diff --git a/assets/styles/layout/_code.scss b/assets/styles/layout/_code.scss index 450ebdf09..3735a13f8 100644 --- a/assets/styles/layout/_code.scss +++ b/assets/styles/layout/_code.scss @@ -27,7 +27,7 @@ pre[class*="language-"] { background: transparent; margin: 0; padding: 0; - max-height: 40rem; + max-height: 60rem; overflow: auto; &:before, &:after { @@ -131,7 +131,7 @@ pre[class*="language-"] { pre[class*="language-"] { code { - background: var(--demo-code-bg) !important; + background: var(--demo-code-bg); transition: background-color .5s, border-color .5s; } } @@ -140,7 +140,7 @@ pre[class*="language-"] { &[data-p-theme^="md-"] { pre[class*="language-"] { code { - background: var(--surface-900) !important; + background: var(--surface-900); } } } diff --git a/assets/styles/layout/_doc.scss b/assets/styles/layout/_doc.scss index bf773bdfc..715cf8315 100644 --- a/assets/styles/layout/_doc.scss +++ b/assets/styles/layout/_doc.scss @@ -194,38 +194,6 @@ } } - -.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); - } - } -} - -.doc-section-code-tooltip .p-tooltip-text { - padding: 0.5rem; - font-size: 11px; -} - .doc-section-code { position: relative; @@ -238,8 +206,56 @@ &:not(:last-child) { margin-bottom: 1rem; } + + &:hover { + .doc-section-code-buttons { + display: flex; + } + } } +.doc-section-code-buttons { + position: absolute; + align-items: center; + justify-content: end; + z-index: 1; + top: .75rem; + right: .75rem; + gap: .75rem; + display: none; + background: rgba(255,255,255,.05); + border-radius: 10px; + padding: 4px; + backdrop-filter: blur(20px); + + button { + outline: 0 none; + border-radius: 10px; + 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); + } + + &.code-active { + color: #bbf7d0; + } + } +} + +.doc-section-code-tooltip .p-tooltip-text { + padding: 0.5rem; + font-size: 11px; +} + + + .doc-tablewrapper { overflow: auto; } diff --git a/components/doc/DocSectionCode.vue b/components/doc/DocSectionCode.vue index 989ee9323..c3b36bead 100644 --- a/components/doc/DocSectionCode.vue +++ b/components/doc/DocSectionCode.vue @@ -1,30 +1,25 @@