|
46 | 46 | </script> |
47 | 47 |
|
48 | 48 | <div class="code-block" class:full-bleed={fullBleed} bind:this={codeBlockElement}> |
49 | | - {#if filename} |
50 | | - <div class="filename">{filename}</div> |
51 | | - {/if} |
52 | | - {#if lang} |
53 | | - <div class="lang">{lang}</div> |
54 | | - {/if} |
55 | | - <button |
56 | | - class={`copy-button ${showCheckmark ? 'copy-button-green' : 'copy-button-gray'}`} |
57 | | - onclick={copyToClipboard} |
58 | | - > |
59 | | - {#if showCheckmark} |
60 | | - <Icon icon="charm:tick" color="#6cdb2e" /> |
61 | | - {:else} |
62 | | - <Icon icon="ion:copy-outline" color="#FFFFFF" /> |
| 49 | + <div class="code-block-info"> |
| 50 | + {#if filename} |
| 51 | + <div class="filename">{filename}</div> |
63 | 52 | {/if} |
64 | | - </button> |
| 53 | + {#if lang} |
| 54 | + <div class="lang">{lang}</div> |
| 55 | + {/if} |
| 56 | + <button |
| 57 | + class={`copy-button ${showCheckmark ? 'copy-button-green' : 'copy-button-gray'}`} |
| 58 | + onclick={copyToClipboard} |
| 59 | + > |
| 60 | + {#if showCheckmark} |
| 61 | + Code Copied <Icon icon="charm:tick" color="#6cdb2e" /> |
| 62 | + {:else} |
| 63 | + Copy Code<Icon icon="ion:copy-outline" color="#FFFFFF" /> |
| 64 | + {/if} |
| 65 | + </button> |
| 66 | + </div> |
65 | 67 | <div class="code-content"> |
66 | 68 | {#if code} |
67 | 69 | <pre><code |
|
85 | 87 | line-height: 1.33em; |
86 | 88 | border-radius: 8px; |
87 | 89 | box-shadow: var(--card-shadow); |
88 | | - padding: 12px 10px 20px 10px; |
| 90 | + padding: 0 0 20px 0; |
89 | 91 | min-height: 80px; |
90 | 92 | background-color: #282c34 !important; |
91 | | -
|
| 93 | + border: 1px solid gray; |
92 | 94 | margin: 30px 0; |
93 | 95 |
|
94 | 96 | :global(pre) { |
|
111 | 113 |
|
112 | 114 | .code-content code { |
113 | 115 | border-radius: 8px; |
| 116 | + margin: 1rem 0.5rem 0 0.5rem; |
| 117 | + padding: 20px; |
| 118 | + } |
| 119 | +
|
| 120 | + .code-block-info { |
| 121 | + display: flex; |
| 122 | + justify-content: space-between; |
| 123 | + border-bottom: 1px solid gray; |
| 124 | + padding: 0.3rem 0.5rem; |
114 | 125 | } |
115 | 126 |
|
116 | 127 | .lang { |
117 | | - position: absolute; |
118 | | - right: 0; |
119 | | - top: -15px; |
120 | | - background-color: rgba(36, 36, 36, 1); |
121 | | - border-radius: 8px; |
122 | 128 | padding: 5px 10px; |
123 | 129 | z-index: 2; |
124 | | - font-size: 0.85em; |
| 130 | + font-size: 1em; |
125 | 131 | } |
126 | 132 |
|
127 | 133 | .filename { |
|
137 | 143 | } |
138 | 144 |
|
139 | 145 | .copy-button { |
140 | | - position: absolute; |
141 | | - top: 1.5rem; |
142 | | - right: 1.5rem; |
143 | | - padding: 0.25rem; |
| 146 | + display: flex; |
| 147 | + justify-content: center; |
| 148 | + align-items: center; |
| 149 | + border: 1px solid gray; |
144 | 150 | border-radius: 0.375rem; |
| 151 | + gap: 0.5rem; |
| 152 | + padding: 0.25rem 0.5rem; |
145 | 153 | box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); |
146 | 154 | cursor: pointer; |
| 155 | + font-size: 0.85em; |
147 | 156 | } |
148 | 157 |
|
149 | 158 | .copy-button-green { |
|
0 commit comments