Skip to content

Commit b3a9df6

Browse files
authored
refactor: styles (#258)
## What Did You Change? Break up styles so "entrypoint" to contribute CSS is smaller. <details> - **Reorganized styles.** - Offer `inbox.css` (free-form) and `import.css` (structured). - Hide advanced stylesheets in subdirectories. - Renamed extra JavaScript file. <sup>(unused, empty)</sup> </details> ## Do You Want Support (syntax, design, etc)? Does this structure to make CSS approachable or more intimidating? **BEFORE** [One 300-line stylesheet](https://github.com/DesignSafe-CI/DS-User-Guide/blob/v3.0.0/user-guide/css/ds-user-guide.css) (organized and commented). ``` . ├── ds-user-guide.css └── README.md ``` **AFTER** Many small stylesheets. One [import stylesheet](https://github.com/DesignSafe-CI/DS-User-Guide/blob/refactor/css-and-js/user-guide/css/import.css). One ["inbox" stylesheet](https://github.com/DesignSafe-CI/DS-User-Guide/blob/refactor/css-and-js/user-guide/css/inbox.css). ``` . ├── ds-user-guide │ ├── … │ └── … ├── for-other-repos │ ├── … │ └── … ├── tacc │ ├── … │ └── … ├── import.css ├── inbox.css └── README.md ```
1 parent f720b93 commit b3a9df6

27 files changed

+315
-286
lines changed

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ theme:
2424
nav_name: User Guide
2525

2626
extra_css:
27-
- css/ds-user-guide.css
27+
- css/import.css
2828

2929
extra_javascript:
30-
- js/ds-user-guide.js
30+
- js/import.js
3131
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js # for pymdownx.arithmatex
3232

3333
markdown_extensions:

user-guide/css/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# DesignSafe User Guide Styles
22

3-
Styles specific to DS-User-Guide should be in this directory.
4-
5-
Styles for all TACC-themed docs belong in https://github.com/TACC/mkdocs-tacc.
3+
1. Create your CSS file in appropriate folder, or add CSS `inbox.css` if unsure.
4+
2. For each file you add, `@import` it in `_import.css` in respective folder.

user-guide/css/ds-user-guide.css

Lines changed: 0 additions & 280 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* DESIGNSAFE-CI/DS-USER-GUIDE */
2+
/* To add CSS unique to DesignSafe/DS-User-Guide */
3+
4+
@import url('definition-lists.css');
5+
@import url('hide-extra-space.css');
6+
@import url('hide-some-anchor-links.css');
7+
@import url('horizontal-rule.css');
8+
@import url('mimic-designsafe-logo.css');
9+
@import url('subtitle-via-attribute.css');
10+
@import url('titles-long-and-short.css');
11+
@import url('unindent-details-in-lists.css');
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* To style definition lists */
2+
/* https://python-markdown.github.io/extensions/definition_lists/ */
3+
/* TODO: Consider moving to Core-Styles and demo-ing in Mkdocs-TACC */
4+
dt {
5+
font-weight: bold;
6+
}
7+
dd {
8+
margin-bottom: 1em;
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* To hide unused space at bottom of overview pages */
2+
/* https://github.com/TACC/TACC-Docs/blob/a9d01e1/docs/css/core/tacc-docs.css#L568-L574 */
3+
[data-page-name$="usecases/overview.md"] footer {
4+
display: none; /* undo theme.css */
5+
}
6+
[data-page-name$="usecases/overview.md"] .wy-nav-content {
7+
padding-bottom: 0; /* undo theme.css */
8+
}
9+
10+
/* To hide extra spacing caused by paragraph side-effect of nested <details> */
11+
details li > p {
12+
margin: 0;
13+
}
14+
/* To hide extra spacing caused by core-styles space on all <details> */
15+
li > details {
16+
margin: 0;
17+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* To hide anchor link for deeper headings */
2+
:is(h4, h5, h6) .headerlink {
3+
display: none;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* A custom horizontal rule to use between large documents */
2+
hr.spacer {
3+
margin-block: 20rem 5rem;
4+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* To write "DESIGNSAFE" like its logo */
2+
/* FAQ: To use, write `# <u><b>Design</b>Safe</u>` */
3+
:where(h1, h2, h3, h4, h5, h6) > u {
4+
text-transform: uppercase;
5+
text-decoration: none;
6+
font-weight: var(--medium);
7+
color: #565656;
8+
9+
/* To use DesignSafe logo font */
10+
font-family: Futura; /* WARNING: requires user have this font installed */
11+
}
12+
:where(h1, h2, h3, h4, h5, h6) > u > b {
13+
color: #cb463f;
14+
font-weight: var(--black);
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* To add subtitle after headings */
2+
[data-subtitle]::after {
3+
content: ' ' attr(data-subtitle);
4+
}
5+
[data-subtitle]:not(
6+
/* headings only distinguished by weight */
7+
h5, h6
8+
)::after {
9+
font-weight: normal;
10+
}
11+
[data-subtitle]:is(
12+
/* headings that need subtitle below */
13+
h1
14+
)::after {
15+
text-transform: none;
16+
font-size: var(--global-font-size--xx-large);
17+
}

0 commit comments

Comments
 (0)