Files
docs/src/css/custom.css
T
HesterG 04a97d20b1 Add api page (#32)
# Changes

- Added [redocusaurus](https://github.com/rohit-gohri/redocusaurus) package to display swagger api with reference to [woodpecker](https://github.com/woodpecker-ci/woodpecker/tree/master/docs)
- Change `sed` for swagger.json for proper version and baseurl.
- Add a dropdown for different api versions. (screenshot below)
- On API pages, only API version dropdown will show(hide locale dropdown, version dropdown for doc, and doc search)
- Allow build CSR API pages for development so it saves building time.

# Screenshots

![Screen Shot 2023-06-27 at 11.56.59](/attachments/7f43976d-f9f1-42ff-85f5-0bc84e549441)

![Screen Shot 2023-06-27 at 10.58.11](/attachments/bde25da5-b0a6-4908-9c69-c6aed41f8f59)

![Screen Shot 2023-06-21 at 12.26.26](/attachments/84a9bf5a-229b-4031-9654-3bae6cb3301a)

![Screen Shot 2023-06-19 at 16.34.33](/attachments/653b2b59-bc8a-4e6c-82f2-eb9710f55d8d)

Search:

![Screen Shot 2023-06-21 at 14.49.15](/attachments/3a09bd89-36a8-4156-a2df-2d3176d3ddb1)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/32
Co-authored-by: HesterG <[email protected]>
Co-committed-by: HesterG <[email protected]>
2023-07-05 03:54:54 +00:00

115 lines
3.7 KiB
CSS

/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/
/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
[data-theme='dark'] [class*='announcementBar'] {
color: var(--ifm-font-color-base);
background-color: var(--ifm-background-color);
}
[data-theme='dark'] .close {
color: var(--ifm-color-white);
}
.outdated-text {
margin: 20px 0;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: none;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
letter-spacing: 0.01071em;
background-color: rgb(229, 246, 253);
display: flex;
padding: 6px 16px;
color: rgb(1, 67, 97);
}
[data-theme='dark'] .outdated-text {
background-color: rgb(7, 19, 24);
color: rgb(184, 231, 251);
}
.redocusaurus .menu-content {
top: 70px !important;
height: calc(100vh - 70px) !important;
}
/* The following css is for toggling API version dropdown/menu,
selectors like :first-of-type are for browsers those do not support :has */
/* Do not show doc search on api pages */
body:has(.redocusaurus) [class*='searchBox'],
.plugin-redoc [class*='searchBox'],
.plugin-pages [class*='searchBox'] {
display: none;
}
@media (min-width: 996px) {
/* hide api-dropdown on other pages */
.navbar__item.dropdown:not(:has(.api-dropdown)),
.navbar__item.dropdown:first-of-type {
display: none;
}
/* show api-dropdown dropdown and hide other dropdowns on api pages */
body:has(.redocusaurus) .navbar__item.dropdown:not(:has(.api-dropdown)),
.plugin-redoc .navbar__item.dropdown:not(:first-of-type),
.plugin-pages .navbar__item.dropdown:not(:first-of-type) {
display: none;
}
body:has(.redocusaurus) .navbar__item.dropdown:has(.api-dropdown),
.plugin-redoc .navbar__item.dropdown:first-of-type,
.plugin-pages .navbar__item.dropdown:first-of-type {
display: block;
}
}
@media (max-width: 996px) {
/* need to find a way to customize the classname */
/* on mobile, dropdown becomes menu list */
/* Hide api version menu on other pages */
.menu__list-item.menu__list-item--collapsed:has(.api-dropdown),
.menu__list-item.menu__list-item--collapsed:nth-of-type(3) {
display: none;
}
/* Hide collapsible menus except for API menu on API pages */
body:has(.redocusaurus) .menu__list-item.menu__list-item--collapsed:not(:has(.api-dropdown)),
.plugin-redoc .menu__list-item.menu__list-item--collapsed:not(:first-of-type),
.plugin-pages .menu__list-item.menu__list-item--collapsed:not(:first-of-type) {
display: none;
}
/* Show collapsible API menu on API pages */
body:has(.redocusaurus) .menu__list-item:has(.api-dropdown),
.plugin-redoc .menu__list-item:nth-of-type(3),
.plugin-pages .menu__list-item:nth-of-type(3) {
display: list-item !important;
}
}