Skip to content

Commit a0e9a60

Browse files
committed
admonitions: add golioth admonition
Extend admonitions to include a Golioth admonition. Use this admonition in the same way you would built-in types: ``` :::golioth Option Title Here Your admonition message goes here. ::: ``` Signed-off-by: Mike Szczys <mike@golioth.io>
1 parent 41a6872 commit a0e9a60

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

docusaurus.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ module.exports = {
167167
routeBasePath: "/",
168168
sidebarPath: require.resolve("./sidebars.js"),
169169
// editUrl: 'https://github.com/golioth/golioth/edit/master/docs/',
170+
admonitions: {
171+
keywords: ['golioth'],
172+
extendDefaults: true,
173+
},
170174
},
171175
gtag: {
172176
trackingID: "G-C2MSLQD9D7",

src/css/custom.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,18 @@ html[data-theme="dark"] {
146146
flex-direction: column;
147147
}
148148
}
149+
150+
/* Golioth admonition */
151+
.alert--golioth {
152+
--ifm-alert-background-color: var(--golioth-color-concrete);
153+
--ifm-alert-background-color-highlight: var(--golioth-color-white);
154+
--ifm-alert-foreground-color:var(--golioth-color-black);
155+
--ifm-alert-border-color: var(--golioth-color-coral);
156+
}
157+
158+
html[data-theme='dark'] .alert--golioth {
159+
--ifm-alert-background-color: var(--golioth-color-cod-gray);
160+
--ifm-alert-background-color-highlight: var(--golioth-color-charcoal);
161+
--ifm-alert-foreground-color: var(--golioth-color-white);
162+
--ifm-alert-border-color: var(--golioth-color-coral);
163+
}

src/theme/Admonition/Icon/Golioth.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
export default function AdmonitionIconGolioth(props) {
3+
return (
4+
<svg viewBox="0 0 400 356">
5+
<path
6+
fill="#ff5760"
7+
d="M 222.22,89.00 C 222.22,89.00 222.22,44.49 222.22,44.49 222.22,44.49 177.78,44.49 177.78,44.49 177.78,44.49 177.78,89.00 177.78,89.00 177.78,89.00 44.44,89.00 44.44,89.00 44.44,89.00 44.44,133.49 44.44,133.49 44.44,133.49 133.33,133.49 133.33,133.49 133.33,133.49 133.33,311.49 133.33,311.49 133.33,311.49 177.78,311.49 177.78,311.49 177.78,311.49 177.78,222.49 177.78,222.49 177.78,222.49 222.22,222.49 222.22,222.49 222.22,222.49 222.22,311.49 222.22,311.49 222.22,311.49 266.67,311.49 266.67,311.49 266.67,311.49 266.67,133.49 266.67,133.49 266.67,133.49 355.56,133.49 355.56,133.49 355.56,133.49 355.56,89.00 355.56,89.00 355.56,89.00 222.22,89.00 222.22,89.00 Z"
8+
/>
9+
</svg>
10+
);
11+
}

src/theme/Admonition/Type/Golioth.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import Translate from '@docusaurus/Translate';
4+
import AdmonitionLayout from '@theme/Admonition/Layout';
5+
import IconGolioth from '@theme/Admonition/Icon/Golioth';
6+
7+
const infimaClassName = 'alert alert--golioth';
8+
const defaultProps = {
9+
icon: <IconGolioth />,
10+
title: (
11+
<Translate
12+
id="theme.admonition.golioth"
13+
description="The default label used for the Golioth admonition (:::golioth)">
14+
golioth
15+
</Translate>
16+
),
17+
};
18+
19+
export default function AdmonitionTypeGolioth(props) {
20+
return (
21+
<AdmonitionLayout
22+
{...defaultProps}
23+
{...props}
24+
className={clsx(infimaClassName, props.className)}>
25+
{props.children}
26+
</AdmonitionLayout>
27+
);
28+
}

src/theme/Admonition/Types.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import DefaultAdmonitionTypes from '@theme-original/Admonition/Types';
3+
import AdmonitionTypeGolioth from '@theme/Admonition/Type/Golioth';
4+
5+
const admonitionTypes = {
6+
...DefaultAdmonitionTypes,
7+
golioth: AdmonitionTypeGolioth,
8+
};
9+
10+
export default admonitionTypes;

0 commit comments

Comments
 (0)