Skip to content

Commit 47f6796

Browse files
committed
✨ Add dropdowns and icons
1 parent 7270ba1 commit 47f6796

16 files changed

+691
-9
lines changed

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ include README.md
1818

1919
include sphinx_design/py.typed
2020
include sphinx_design/compiled/style.min.css
21+
include sphinx_design/compiled/opticon_LICENSE
22+
include sphinx_design/compiled/opticons.json

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ This package is an iteration on sphinx-panels and intends to replace it.
3434

3535
## TODO
3636

37+
note that directly using classes should be used as a "last resort",
38+
and to please open an issue if you find you are commonly using a certain class.
39+
40+
grids items cannot contain headers, is this in anyway possible with docutils structure?
41+
3742
- directives:
3843
- dropdowns (optional), dropdown
3944
- tabs (optional), tab
@@ -58,3 +63,5 @@ horizontal card (grid row inside card, picture on left)
5863
avatars (rounded images)
5964

6065
horizontally scrollable cards: (see <https://stackoverflow.com/questions/35993300/horizontally-scrollable-list-of-cards-in-bootstrap>)
66+
67+
align icon and text in dropdown title

docs/index.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,64 @@ next paragraph 1
106106

107107
::::
108108

109+
### Nested grids
110+
111+
::::::{grid}
112+
:columns: 1 1 2 2
113+
:gutter: 1
114+
115+
:::::{grid-item}
116+
117+
::::{grid}
118+
:columns: 1 1 1 1
119+
:gutter: 1
120+
121+
:::{grid-item-card}
122+
123+
{{ loremipsum }}
124+
125+
:::
126+
127+
:::{grid-item-card}
128+
129+
B
130+
131+
:::
132+
133+
::::
134+
135+
:::::
136+
137+
:::::{grid-item}
138+
139+
::::{grid}
140+
:columns: 1 1 1 1
141+
:gutter: 1
142+
143+
:::{grid-item-card}
144+
145+
C
146+
147+
:::
148+
149+
:::{grid-item-card}
150+
151+
D
152+
153+
:::
154+
155+
:::{grid-item-card}
156+
157+
E
158+
159+
:::
160+
161+
::::
162+
163+
:::::
164+
165+
::::::
166+
109167
(badges)=
110168

111169
## Badges
@@ -167,3 +225,50 @@ Button text
167225
```
168226

169227
:::
228+
229+
## Dropdown
230+
231+
:::{dropdown} Dropdown title
232+
Dropdown content
233+
:::
234+
235+
:::{dropdown}
236+
Dropdown content
237+
:::
238+
239+
::::{dropdown} Parent dropdown title (open by default)
240+
:open:
241+
242+
:::{dropdown} Child dropdown title
243+
:color: warning
244+
:icon: alert
245+
246+
Dropdown content
247+
:::
248+
::::
249+
250+
### Dropdowns in a grid
251+
252+
:::::{grid}
253+
:columns: 1 1 2 2
254+
:gutter: 1
255+
256+
::::{grid-item}
257+
:::{dropdown} Dropdown title
258+
Dropdown content
259+
:::
260+
::::
261+
262+
::::{grid-item}
263+
:::{dropdown} Dropdown title
264+
Dropdown content
265+
:::
266+
::::
267+
268+
:::::
269+
270+
## Icons
271+
272+
Some {opticon-16}`report;sd-text-info` middle {opticon-24}`report` more text
273+
274+
{fas}`spinner;sd-bg-primary sd-bg-text-primary fa-2x`

sphinx_design/cards.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ def create_card(
6565
card_classes = ["sd-card", "sd-sphinx-override"]
6666
if "width" in options:
6767
card_classes += [f'sd-w-{options["width"]}']
68-
if "margin" in options:
69-
card_classes += options["margin"]
68+
card_classes += options.get("margin", ["sd-mb-3"])
7069
if "no-shadow" not in options:
7170
card_classes += ["sd-shadow"]
7271
if "hover" in options:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 GitHub Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

sphinx_design/compiled/opticons.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

sphinx_design/compiled/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)