Skip to content

Commit d2fdbc3

Browse files
Merge branch 'main' into update-csharp-snippet-titles
2 parents 5726f2b + 641f0ee commit d2fdbc3

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
node_modules
22
dist
3+
snippets
4+
public
35
.vite
46
coverage
57
package-lock.json

public/consolidated/scss.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@
9595
"contributors": [],
9696
"code": "@mixin aspect-ratio($width, $height) {\n position: relative;\n width: 100%;\n padding-top: ($height / $width) * 100%;\n > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n}\n"
9797
},
98+
{
99+
"title": "Dark Theme",
100+
"description": "SCSS mixin to change styles for dark themes.",
101+
"author": "gihanrangana",
102+
"tags": [
103+
"scss",
104+
"css",
105+
"mixin",
106+
"snippet",
107+
"dark-theme",
108+
"layout"
109+
],
110+
"contributors": [],
111+
"code": "@mixin isDark($type: 'module') {\n $root: &;\n\n @if $type == 'module' {\n :global {\n @at-root body[theme='dark'] #{$root} {\n @content;\n }\n }\n } @else {\n &[theme='dark'] {\n @content;\n }\n }\n}\n\n// Usage:\n.container{\n\tbackground: #f0f0f0;\n\t@include isDark {\n\t\tbackground: #222;\n\t}\n}\n"
112+
},
98113
{
99114
"title": "Flex Center",
100115
"description": "A mixin to center content using flexbox.",

snippets/scss/layouts/dark-theme.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Dark Theme
3+
description: SCSS mixin to change styles for dark themes.
4+
author: gihanrangana
5+
tags: scss, css, mixin, snippet, dark-theme, layout
6+
---
7+
8+
```scss
9+
@mixin isDark($type: 'module') {
10+
$root: &;
11+
12+
@if $type == 'module' {
13+
:global {
14+
@at-root body[theme='dark'] #{$root} {
15+
@content;
16+
}
17+
}
18+
} @else {
19+
&[theme='dark'] {
20+
@content;
21+
}
22+
}
23+
}
24+
25+
// Usage:
26+
.container{
27+
background: #f0f0f0;
28+
@include isDark {
29+
background: #222;
30+
}
31+
}
32+
```

src/styles/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ abbr {
367367

368368
position: absolute;
369369
width: 100%;
370-
max-height: 15rem;
370+
max-height: 20rem;
371371
overflow-y: auto;
372372

373373
background-color: var(--clr-bg-secondary);

0 commit comments

Comments
 (0)