diff options
| author | 安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com> | 2024-01-25 00:15:16 +0900 |
|---|---|---|
| committer | 安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com> | 2024-01-25 00:15:16 +0900 |
| commit | 02c3492b3d574812b5391979e04c399e350a26ed (patch) | |
| tree | 2b492ac9564da6b201d035eb4434ea76e3f64478 /src/theme/Admonition/Type | |
| parent | 5970320e4994df7652eedea9e16770e1720342f8 (diff) | |
initial commit
Diffstat (limited to 'src/theme/Admonition/Type')
| -rw-r--r-- | src/theme/Admonition/Type/Caution.js | 34 | ||||
| -rw-r--r-- | src/theme/Admonition/Type/Danger.js | 32 | ||||
| -rw-r--r-- | src/theme/Admonition/Type/Info.js | 32 | ||||
| -rw-r--r-- | src/theme/Admonition/Type/Note.js | 32 | ||||
| -rw-r--r-- | src/theme/Admonition/Type/Tip.js | 32 | ||||
| -rw-r--r-- | src/theme/Admonition/Type/Warning.js | 32 |
6 files changed, 194 insertions, 0 deletions
diff --git a/src/theme/Admonition/Type/Caution.js b/src/theme/Admonition/Type/Caution.js new file mode 100644 index 00000000..a7bc5440 --- /dev/null +++ b/src/theme/Admonition/Type/Caution.js @@ -0,0 +1,34 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import React from 'react'; +import clsx from 'clsx'; +import Translate from '@docusaurus/Translate'; +import AdmonitionLayout from '../Layout'; +import IconWarning from '@docusaurus/theme-classic/lib/theme/Admonition/Icon/Warning'; +const infimaClassName = 'alert alert--warning'; +const defaultProps = { + icon: <IconWarning />, + title: ( + <Translate + id="theme.admonition.caution" + description="The default label used for the Caution admonition (:::caution)"> + caution + </Translate> + ), +}; +// TODO remove before v4: Caution replaced by Warning +// see https://github.com/facebook/docusaurus/issues/7558 +export default function AdmonitionTypeCaution(props) { + return ( + <AdmonitionLayout + {...defaultProps} + {...props} + className={clsx(infimaClassName, props.className)}> + {props.children} + </AdmonitionLayout> + ); +} diff --git a/src/theme/Admonition/Type/Danger.js b/src/theme/Admonition/Type/Danger.js new file mode 100644 index 00000000..39e37f69 --- /dev/null +++ b/src/theme/Admonition/Type/Danger.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import React from 'react'; +import clsx from 'clsx'; +import Translate from '@docusaurus/Translate'; +import AdmonitionLayout from '../Layout'; +import IconDanger from '@docusaurus/theme-classic/lib/theme/Admonition/Icon/Danger'; +const infimaClassName = 'alert alert--danger'; +const defaultProps = { + icon: <IconDanger />, + title: ( + <Translate + id="theme.admonition.danger" + description="The default label used for the Danger admonition (:::danger)"> + danger + </Translate> + ), +}; +export default function AdmonitionTypeDanger(props) { + return ( + <AdmonitionLayout + {...defaultProps} + {...props} + className={clsx(infimaClassName, props.className)}> + {props.children} + </AdmonitionLayout> + ); +} diff --git a/src/theme/Admonition/Type/Info.js b/src/theme/Admonition/Type/Info.js new file mode 100644 index 00000000..44409a44 --- /dev/null +++ b/src/theme/Admonition/Type/Info.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import React from 'react'; +import clsx from 'clsx'; +import Translate from '@docusaurus/Translate'; +import AdmonitionLayout from '../Layout'; +import IconInfo from '@docusaurus/theme-classic/lib/theme/Admonition/Icon/Info'; +const infimaClassName = 'alert alert--info'; +const defaultProps = { + icon: <IconInfo />, + title: ( + <Translate + id="theme.admonition.info" + description="The default label used for the Info admonition (:::info)"> + info + </Translate> + ), +}; +export default function AdmonitionTypeInfo(props) { + return ( + <AdmonitionLayout + {...defaultProps} + {...props} + className={clsx(infimaClassName, props.className)}> + {props.children} + </AdmonitionLayout> + ); +} diff --git a/src/theme/Admonition/Type/Note.js b/src/theme/Admonition/Type/Note.js new file mode 100644 index 00000000..01226d2f --- /dev/null +++ b/src/theme/Admonition/Type/Note.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import React from 'react'; +import clsx from 'clsx'; +import Translate from '@docusaurus/Translate'; +import AdmonitionLayout from '../Layout'; +import IconNote from '@docusaurus/theme-classic/lib/theme/Admonition/Icon/Note'; +const infimaClassName = 'alert alert--secondary'; +const defaultProps = { + icon: <IconNote />, + title: ( + <Translate + id="theme.admonition.note" + description="The default label used for the Note admonition (:::note)"> + note + </Translate> + ), +}; +export default function AdmonitionTypeNote(props) { + return ( + <AdmonitionLayout + {...defaultProps} + {...props} + className={clsx(infimaClassName, props.className)}> + {props.children} + </AdmonitionLayout> + ); +} diff --git a/src/theme/Admonition/Type/Tip.js b/src/theme/Admonition/Type/Tip.js new file mode 100644 index 00000000..bbe7de19 --- /dev/null +++ b/src/theme/Admonition/Type/Tip.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import React from 'react'; +import clsx from 'clsx'; +import Translate from '@docusaurus/Translate'; +import AdmonitionLayout from '../Layout'; +import IconTip from '@docusaurus/theme-classic/lib/theme/Admonition/Icon/Tip'; +const infimaClassName = 'alert alert--success'; +const defaultProps = { + icon: <IconTip />, + title: ( + <Translate + id="theme.admonition.tip" + description="The default label used for the Tip admonition (:::tip)"> + tip + </Translate> + ), +}; +export default function AdmonitionTypeTip(props) { + return ( + <AdmonitionLayout + {...defaultProps} + {...props} + className={clsx(infimaClassName, props.className)}> + {props.children} + </AdmonitionLayout> + ); +} diff --git a/src/theme/Admonition/Type/Warning.js b/src/theme/Admonition/Type/Warning.js new file mode 100644 index 00000000..ac28ae39 --- /dev/null +++ b/src/theme/Admonition/Type/Warning.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import React from 'react'; +import clsx from 'clsx'; +import Translate from '@docusaurus/Translate'; +import AdmonitionLayout from '../Layout'; +import IconWarning from '@docusaurus/theme-classic/lib/theme/Admonition/Icon/Warning'; +const infimaClassName = 'alert alert--warning'; +const defaultProps = { + icon: <IconWarning />, + title: ( + <Translate + id="theme.admonition.warning" + description="The default label used for the Warning admonition (:::warning)"> + warning + </Translate> + ), +}; +export default function AdmonitionTypeWarning(props) { + return ( + <AdmonitionLayout + {...defaultProps} + {...props} + className={clsx(infimaClassName, props.className)}> + {props.children} + </AdmonitionLayout> + ); +} |
