]> BookStack Code Mirror - bookstack/blob - resources/sass/_blocks.scss
Cleaned up dark mode styles inc. setting browser color scheme
[bookstack] / resources / sass / _blocks.scss
1
2 /**
3  * Callouts
4  */
5 .callout {
6   border-inline-start: 3px solid #BBB;
7   background-color: #EEE;
8   padding: $-s $-s $-s $-xl;
9   display: block;
10   position: relative;
11   overflow: auto;
12   &:before {
13     background-image: url('data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9IiMwMTUzODAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+ICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz4gICAgPHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6bTEgMTVoLTJ2LTZoMnY2em0wLThoLTJWN2gydjJ6Ii8+PC9zdmc+');
14     background-repeat: no-repeat;
15     content: '';
16     width: 1.2em;
17     height: 1.2em;
18     left: $-xs + 2px;
19     top: 50%;
20     margin-top: -9px;
21     display: inline-block;
22     position: absolute;
23     line-height: 1;
24     opacity: 0.8;
25   }
26   &.success {
27     border-left-color: $positive;
28     @include lightDark(background-color, lighten($positive, 68%), darken($positive, 22%));
29     @include lightDark(color, darken($positive, 16%), lighten($positive, 5%));
30   }
31   &.success:before {
32     background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9IiMzNzZjMzkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+ICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz4gICAgPHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6bS0yIDE1bC01LTUgMS40MS0xLjQxTDEwIDE0LjE3bDcuNTktNy41OUwxOSA4bC05IDl6Ii8+PC9zdmc+");
33   }
34   &.danger {
35     border-left-color: $negative;
36     @include lightDark(background-color, lighten($negative, 56%), darken($negative, 30%));
37     @include lightDark(color, darken($negative, 20%), lighten($negative, 5%));
38   }
39   &.danger:before {
40     background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9IiNiOTE4MTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+ICAgIDxwYXRoIGQ9Ik0xNS43MyAzSDguMjdMMyA4LjI3djcuNDZMOC4yNyAyMWg3LjQ2TDIxIDE1LjczVjguMjdMMTUuNzMgM3pNMTIgMTcuM2MtLjcyIDAtMS4zLS41OC0xLjMtMS4zIDAtLjcyLjU4LTEuMyAxLjMtMS4zLjcyIDAgMS4zLjU4IDEuMyAxLjMgMCAuNzItLjU4IDEuMy0xLjMgMS4zem0xLTQuM2gtMlY3aDJ2NnoiLz4gICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==");
41   }
42   &.info {
43     border-left-color: $info;
44     @include lightDark(color, darken($info, 20%), lighten($info, 10%));
45     @include lightDark(background-color, lighten($info, 50%), darken($info, 35%));
46   }
47   &.warning {
48     border-left-color: $warning;
49     @include lightDark(background-color, lighten($warning, 50%), darken($warning, 36%));
50     @include lightDark(color, darken($warning, 20%), $warning);
51   }
52   &.warning:before {
53     background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9IiNiNjUzMWMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+ICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz4gICAgPHBhdGggZD0iTTEgMjFoMjJMMTIgMiAxIDIxem0xMi0zaC0ydi0yaDJ2MnptMC00aC0ydi00aDJ2NHoiLz48L3N2Zz4=");
54   }
55   a {
56     color: inherit;
57     text-decoration: underline;
58   }
59 }
60
61 /**
62  * Card-style blocks
63  */
64
65 .card {
66   @include lightDark(background-color, #FFF, #222);
67   box-shadow: $bs-card;
68   border-radius: 3px;
69   .body, p.empty-text {
70     padding: $-m;
71   }
72   a, p {
73     word-wrap: break-word;
74     word-break: break-word;
75   }
76 }
77
78 .card-title {
79   padding: $-m $-m $-xs;
80   margin: 0;
81   font-size: $fs-m;
82   color: #222;
83   fill: #222;
84   font-weight: 400;
85 }
86 .card-title a {
87   line-height: 1;
88 }
89 .card-footer-link, button.card-footer-link  {
90   display: block;
91   padding: $-s $-m;
92   line-height: 1;
93   border-top: 1px solid;
94   width: 100%;
95   text-align: left;
96   @include lightDark(border-color, #DDD, #555);
97   border-radius: 0 0 3px 3px;
98   font-size: 0.9em;
99   margin-top: $-xs;
100   &:hover {
101     text-decoration: none;
102     @include lightDark(background-color, #f2f2f2, #2d2d2d);
103   }
104   &:focus {
105     @include lightDark(background-color, #eee, #222);
106     outline: 1px dotted #666;
107     outline-offset: -2px;
108   }
109 }
110
111 .card.border-card {
112   border: 1px solid;
113   @include lightDark(border-color, #ddd, #000);
114 }
115
116 .card.drag-card {
117   border: 1px solid #DDD;
118   @include lightDark(border-color, #ddd, #000);
119   @include lightDark(background-color, #fff, #333);
120   border-radius: 4px;
121   display: flex;
122   padding: 0 0 0 ($-s + 28px);
123   margin: $-s 0;
124   position: relative;
125   .drag-card-action {
126     cursor: pointer;
127   }
128   .handle, .drag-card-action {
129     display: flex;
130     align-items: center;
131     text-align: center;
132     justify-content: center;
133     width: 28px;
134     flex-grow: 0;
135     padding: 0 $-xs;
136     &:hover {
137       @include lightDark(background-color, #eee, #2d2d2d);
138     }
139     .svg-icon {
140       margin-inline-end: 0px;
141     }
142   }
143   .outline input {
144     margin: $-s 0;
145     width: 100%;
146   }
147   .outline {
148     position: relative;
149   }
150   .handle {
151     @include lightDark(background-color, #eee, #2d2d2d);
152     left: 0;
153     position: absolute;
154     top: 0;
155     bottom: 0;
156   }
157   > div {
158     padding: 0 $-s;
159     max-width: 80%;
160     flex: 1;
161   }
162 }
163
164 .grid-card {
165   display: flex;
166   flex-direction: column;
167   border: 1px solid #ddd;
168   @include lightDark(border-color, #ddd, #000);
169   margin-bottom: $-l;
170   border-radius: 4px;
171   overflow: hidden;
172   min-width: 100px;
173   color: $text-dark;
174   transition: border-color ease-in-out 120ms, box-shadow ease-in-out 120ms;
175   &:hover {
176     color: $text-dark;
177     text-decoration: none;
178     @include lightDark(box-shadow, $bs-card, $bs-card-dark);
179   }
180   h2 {
181     width: 100%;
182     font-size: 1.5em;
183     margin: 0 0 10px;
184   }
185   p {
186     font-size: .7rem;
187     margin: 0;
188     line-height: 1.6em;
189   }
190   .grid-card-content {
191     flex: 1;
192     border-top: 0;
193     border-bottom-width: 2px;
194   }
195   .grid-card-content, .grid-card-footer {
196     padding: $-l;
197   }
198   .grid-card-content + .grid-card-footer {
199     padding-top: 0;
200   }
201 }
202
203 .book-grid-item .grid-card-footer {
204   p.small {
205     font-size: .8em;
206     margin: 0;
207   }
208 }
209
210 .content-wrap.card {
211   padding: $-m $-xxl;
212   margin-inline-start: auto;
213   margin-inline-end: auto;
214   margin-bottom: $-l;
215   overflow: initial;
216   min-height: 60vh;
217   &.auto-height {
218     min-height: 0;
219   }
220   &.fill-width {
221     width: 100%;
222   }
223 }
224 @include smaller-than($xxl) {
225   .content-wrap.card {
226     padding: $-m $-xl;
227   }
228 }
229 @include smaller-than($m) {
230   .content-wrap.card {
231     padding: $-m $-l;
232   }
233 }
234 @include smaller-than($s) {
235   .content-wrap.card {
236     padding: $-m $-m;
237   }
238 }
239
240 .outline-hover {
241   border: 1px solid transparent !important;
242   &:hover {
243     border: 1px solid rgba(0, 0, 0, 0.1) !important;
244   }
245 }
246
247 .fade-in-when-active {
248   @include lightDark(opacity, 0.6, 0.7);
249   transition: opacity ease-in-out 120ms;
250   &:hover, &:focus-within {
251     opacity: 1 !important;
252   }
253   @media (prefers-contrast: more) {
254     opacity: 1 !important;
255   }
256 }
257
258 /**
259  * Tags
260  */
261 .tag-item {
262   display: inline-flex;
263   margin-bottom: $-xs;
264   margin-inline-end: $-xs;
265   border-radius: 4px;
266   border: 1px solid;
267   overflow: hidden;
268   font-size: 0.85em;
269   @include lightDark(border-color, #CCC, #666);
270   a, span, a:hover, a:active {
271     padding: 4px 8px;
272     @include lightDark(color, rgba(0, 0, 0, 0.7), rgba(255, 255, 255, 0.8));
273     transition: background-color ease-in-out 80ms;
274     text-decoration: none;
275   }
276   a:hover {
277     @include lightDark(background-color, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.3));
278   }
279   svg {
280     @include lightDark(fill, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.5));
281   }
282   .tag-value {
283     border-inline-start: 1px solid;
284     @include lightDark(border-color, #DDD, #666);
285     @include lightDark(background-color, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2))
286   }
287 }
288
289 .tag-name.highlight, .tag-value.highlight {
290   font-weight: bold;
291 }
292
293 .tag-list div:last-child .tag-item {
294   margin-bottom: 0;
295 }
296
297 .item-list-row .tag-item {
298   margin-bottom: 0;
299 }
300
301 /**
302  * API Docs
303  */
304 .api-method {
305   font-size: 0.75rem;
306   background-color: #888;
307   padding: $-xs;
308   line-height: 1.3;
309   opacity: 0.7;
310   vertical-align: top;
311   border-radius: 3px;
312   color: #FFF;
313   display: inline-block;
314   min-width: 60px;
315   text-align: center;
316   font-weight: bold;
317   &[data-method="GET"] { background-color: #077b70 }
318   &[data-method="POST"] { background-color: #cf4d03 }
319   &[data-method="PUT"] { background-color: #0288D1 }
320   &[data-method="DELETE"] { background-color: #ab0f0e }
321 }
322
323 .sticky-sidebar {
324   position: sticky;
325   top: $-m;
326   max-height: calc(100vh - #{$-m});
327   overflow-y: auto;
328 }