Skip to content

Commit 3effe7b

Browse files
Revathyvenugopal162pyansys-ci-botjorgepiloto
authored
feat: migrate css to scss (#644)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Co-authored-by: Jorge Martínez <28702884+jorgepiloto@users.noreply.github.com>
1 parent 14ad2f4 commit 3effe7b

22 files changed

+723
-695
lines changed

.github/workflows/ci_cd.yml

+8-20
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,19 @@ jobs:
3939

4040
changelog-fragment:
4141
name: "Create changelog fragment"
42-
needs: "labeler"
42+
needs: [labeler]
4343
permissions:
4444
contents: write
4545
pull-requests: write
4646
runs-on: ubuntu-latest
4747
steps:
48-
- name: "Setup python"
49-
uses: actions/setup-python@v5
50-
with:
51-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
52-
53-
- name: "Checkout repo"
54-
uses: actions/checkout@v4
55-
56-
- name: "Install dependencies"
57-
run: |
58-
python -m pip install --upgrade pip
59-
pip install -e .[changelog]
60-
61-
- uses: ansys/actions/doc-changelog@v8
62-
if: ${{ github.event_name == 'pull_request' }}
63-
with:
64-
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
65-
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
66-
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
48+
- uses: ansys/actions/doc-changelog@v8
49+
with:
50+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
51+
use-conventional-commits: true
52+
use-default-towncrier-config: true
53+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
54+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
6755

6856
code-style:
6957
name: Code style

doc/changelog.d/644.added.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
migrate css to scss

package.json

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
{
22
"name": "ansys_sphinx_theme",
33
"repository": "https://github.com/ansys/ansys-sphinx-theme",
4-
"description": "",
5-
"main": "",
64
"scripts": {
7-
"build": "echo 'No build step needed' "
5+
"build:scss": "sass src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme.scss src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/ansys-sphinx-theme.css",
6+
"build:postcss": "postcss src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/ansys-sphinx-theme.css -o src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/ansys-sphinx-theme.css",
7+
"build": "npm run build:scss && npm run build:postcss"
88
},
9-
"dependencies": {},
10-
"devDependencies": {}
9+
"devDependencies": {
10+
"autoprefixer": "^10.4.21",
11+
"postcss": "^8.5.3",
12+
"postcss-cli": "^11.0.0",
13+
"postcss-import": "^16.1.0",
14+
"postcss-minify": "^1.1.0",
15+
"postcss-nested": "^7.0.2",
16+
"sass": "^1.85.1"
17+
},
18+
"dependencies": {
19+
"postcss-scss": "^4.0.9"
20+
}
1121
}

postcss.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const config = {
2+
plugins: [
3+
require("autoprefixer"),
4+
require("postcss-minify"),
5+
require("postcss-nested"),
6+
],
7+
};
8+
9+
module.exports = config;

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = [
55
build-backend = "sphinx_theme_builder"
66

77
[tool.sphinx-theme-builder]
8-
node-version = "22.14.0"
8+
node-version = "23.9.0"
99
theme-name = "ansys_sphinx_theme"
1010

1111
[project]

src/ansys_sphinx_theme/__init__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
THIS_PATH = pathlib.Path(__file__).parent.resolve()
5959
THEME_PATH = THIS_PATH / "theme" / "ansys_sphinx_theme"
6060
STATIC_PATH = THEME_PATH / "static"
61-
STYLE_PATH = STATIC_PATH / "css"
61+
STYLE_PATH = STATIC_PATH / "styles"
6262
JS_PATH = STATIC_PATH / "js"
63-
CSS_PATH = STYLE_PATH / "ansys_sphinx_theme.css"
63+
CSS_PATH = STYLE_PATH / "ansys-sphinx-theme.css"
6464
TEMPLATES_PATH = THEME_PATH / "_templates"
6565
AUTOAPI_TEMPLATES_PATH = TEMPLATES_PATH / "autoapi"
6666
LOGOS_PATH = STATIC_PATH / "logos"
@@ -1141,8 +1141,6 @@ def setup(app: Sphinx) -> Dict:
11411141
use_ansys_search = app.config.html_theme_options.get("use_ansys_search", True)
11421142
if use_ansys_search:
11431143
update_search_config(app)
1144-
1145-
# Verify that the main CSS file exists
11461144
if not CSS_PATH.exists():
11471145
raise FileNotFoundError(f"Unable to locate ansys-sphinx theme at {CSS_PATH.absolute()}")
11481146
app.add_css_file(str(CSS_PATH.relative_to(STATIC_PATH)))
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*Contains variables for colors and fonts used in the theme*/
1+
/* Contains variables for colors and fonts used in the theme */
22
@import url("https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&family=Open+Sans:ital,wght@0,400;0,600;1,400;1,600&display=swap");
33

44
@font-face {
+9-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/* Provided by the Sphinx base theme template at build time */
2-
3-
@import "pydata-sphinx-theme-custom.css";
4-
@import "breadcrumbs.css";
5-
@import "ast-search.css";
6-
@import "sphinx-design.css";
7-
@import "table-custom.css";
8-
@import "sphinx-gallery.css";
9-
@import "whatsnew.css";
10-
@import "nbsphinx.css";
11-
@import "ansys-sphinx-theme-variable.css";
2+
@import "ansys-sphinx-theme-variable";
3+
@import "pydata-sphinx-theme-custom";
4+
@import "breadcrumbs";
5+
@import "ast-search";
6+
@import "sphinx-design";
7+
@import "table-custom";
8+
@import "sphinx-gallery";
9+
@import "whatsnew";
10+
@import "nbsphinx";
1211

1312
/*
1413
* Code cell
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,58 @@
1+
/* Static Search Results Container */
12
.static-search-results {
23
display: flex;
34
flex-direction: column;
45
align-content: stretch;
56
justify-content: flex-start;
67
position: absolute;
78
background-color: var(--ast-search-bar-enable-background);
8-
width: 630px;
9+
width: 39.375rem; /* 630px */
910
padding: 1em;
1011
border: 1px solid var(--ast-search-bar-enable-border);
1112
box-shadow: var(--ast-box-shadow-active);
1213
overflow: auto;
13-
max-height: 500px;
14+
max-height: 31.25rem; /* 500px */
1415
}
1516

17+
/* Individual Result Item */
1618
.result-item {
1719
cursor: pointer;
1820
transition: box-shadow 0.3s ease;
1921
border-bottom: thin solid var(--ast-search-bar-enable-border);
2022
padding-bottom: 0.5em;
2123
margin-bottom: 0.5em;
22-
}
2324

24-
.result-item:last-child {
25-
border-bottom: 0;
26-
margin-bottom: 0;
25+
&:last-child {
26+
border-bottom: 0;
27+
margin-bottom: 0;
28+
}
29+
30+
&.selected {
31+
box-shadow: var(--ast-ring-shadow-focused);
32+
}
2733
}
2834

35+
/* Result Title */
2936
.result-title {
3037
font-size: 1em;
3138
font-weight: var(--ast-font-weight-bold);
3239
font-family: "Open Sans", sans-serif;
3340
color: var(--ast-catagory-header-text);
3441
}
3542

43+
/* Result Text */
3644
.result-text {
37-
font-size: 12px;
45+
font-size: 0.75rem; /* 12px */
3846
font-family: "Open Sans", sans-serif;
3947
color: var(--ast-search-bar-enable-text);
4048
}
4149

42-
.result-item.selected {
43-
box-shadow: var(--ast-ring-shadow-focused);
44-
}
45-
50+
/* Highlighted Text */
4651
html[data-theme="light"] .highlight {
4752
color: var(--ast-highlight-color);
4853
}
4954

55+
/* Search Input Styles */
5056
.bd-search input.form-control,
5157
.bd-search input.form-control:focus,
5258
.bd-search input.form-control:focus-visible,
@@ -55,98 +61,108 @@ html[data-theme="light"] .highlight {
5561
.form-control {
5662
background-color: var(--ast-search-bar-enable-background);
5763
color: var(--ast-search-bar-enable-text);
58-
font-size: 14px;
64+
font-size: 0.875rem; /* 14px */
5965
outline-color: var(--ast-search-bar-enable-border);
60-
border: 0px solid var(--ast-search-bar-enable-border);
61-
width: 300px;
66+
border: 0;
67+
width: 18.75rem; /* 300px */
6268
transition: max-width 0.3s ease;
6369
max-width: 200%;
64-
height: 40px;
70+
height: 2.5rem; /* 40px */
6571
}
6672

73+
/* Search Button Wrapper */
6774
.search-button__wrapper.show input,
6875
.search-button__wrapper.show svg {
69-
font-size: 14px;
76+
font-size: 0.875rem; /* 14px */
7077
}
7178

79+
/* Search Button Keyboard Shortcut */
7280
.bd-search .search-button__kbd-shortcut {
7381
background-color: var(--ast-search-bar-enable-background) !important;
7482
box-shadow: none !important;
75-
height: 36px;
83+
height: 2.25rem; /* 36px */
7684
display: flex;
7785
flex-wrap: wrap;
7886
align-content: center;
7987
}
8088

89+
/* Index Select Dropdown */
8190
.index-select {
8291
color: var(--ast-search-bar-enable-text);
8392
background: var(--ast-search-bar-enable-background);
84-
height: 40px;
85-
font-size: 14px;
93+
height: 2.5rem; /* 40px */
94+
font-size: 0.875rem; /* 14px */
8695
font-family: "Open Sans", sans-serif;
87-
border: 0.5px solid var(--ast-search-bar-enable-border);
88-
border-radius: 4px;
96+
border: 0.03125rem solid var(--ast-search-bar-enable-border); /* 0.5px */
97+
border-radius: 0.25rem; /* 4px */
8998
box-shadow: none;
90-
padding: 0px 8px;
91-
margin-left: 2px;
99+
padding: 0 0.5rem; /* 0 8px */
100+
margin-left: 0.125rem; /* 2px */
92101
}
102+
103+
/* Focus Visible Outline */
93104
:focus-visible {
94105
outline: none;
95106
}
96107

108+
/* Search Icon */
97109
#search-icon {
98-
font-size: 24px;
99-
width: 24px;
100-
height: 24px;
110+
font-size: 1.5rem; /* 24px */
111+
width: 1.5rem; /* 24px */
112+
height: 1.5rem; /* 24px */
101113
color: var(--ast-search-bar-enable-text);
102114
}
103115

116+
/* Form Control Focus Styles */
104117
.form-control:focus,
105118
.bd-search:focus-within {
106119
box-shadow: none;
107120
}
108121

109-
/* Button Styling */
122+
/* Search Button Styling */
110123
.search-button__button {
111124
transition: width 0.3s ease;
112-
width: 50px; /* Initial width */
125+
width: 3.125rem; /* 50px */
113126
}
114127

115128
/* Result Container Styling */
116129
.bd-search {
117-
gap: 8px;
130+
gap: 0.5rem; /* 8px */
118131
background-color: var(--ast-search-bar-enable-background);
119-
border: 0px solid var(--ast-search-bar-enable-border);
120-
margin-bottom: 0px;
121-
}
132+
border: 0 solid var(--ast-search-bar-enable-border);
133+
margin-bottom: 0;
122134

123-
.bd-search input.form-control.expanded {
124-
width: 600px;
135+
input.form-control.expanded {
136+
width: 37.5rem; /* 600px */
137+
}
125138
}
126139

140+
/* Search Icon Styling */
127141
.search-icon {
128142
cursor: pointer;
129143
}
130144

145+
/* Blurred Main Content */
131146
.bd-main.blurred {
132147
opacity: 0.5;
133148
transition: opacity 0.3s ease;
134149
}
135150

136-
@media (max-width: 768px) {
151+
/* Responsive Styles */
152+
@media (max-width: 48rem) { /* 768px */
137153
.bd-search input.expanded {
138-
width: 100px;
154+
width: 6.25rem; /* 100px */
139155
}
140156

141157
.form-control {
142-
width: 50px;
158+
width: 3.125rem; /* 50px */
143159
}
144160

145161
.result {
146-
width: 100px;
162+
width: 6.25rem; /* 100px */
147163
}
148164

149165
.bd-search .search-button__kbd-shortcut {
150166
display: none;
151167
}
152-
}
168+
}

0 commit comments

Comments
 (0)