forked from NateWr/ui-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp/pkp-lib#9840 Add mdx and stories for new component
- Loading branch information
Showing
3 changed files
with
97 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {Stories, Meta} from '@storybook/blocks'; | ||
|
||
import * as CodeHighlighterStories from './CodeHighlighter.stories.js'; | ||
|
||
<Meta of={CodeHighlighterStories} /> | ||
|
||
# CodeHighlighter | ||
|
||
## Usage | ||
|
||
Use this component to display a formatted segment of code | ||
|
||
## Supported Languages | ||
|
||
The supported languages include: | ||
|
||
- XML: `language="xml"` | ||
|
||
<Stories /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import CodeHighlighter from './CodeHighlighter.vue'; | ||
|
||
export default { | ||
title: 'Components/CodeHighlighter', | ||
component: CodeHighlighter, | ||
render: (args) => ({ | ||
components: {CodeHighlighter}, | ||
setup() { | ||
return {args}; | ||
}, | ||
template: '<code-highlighter :code=args.code :language=args.language />', | ||
}), | ||
}; | ||
|
||
const sampleXML = `<?xml version="1.0" encoding="UTF-8"?> | ||
<article> | ||
<title>Open Access in Research</title> | ||
<author> | ||
<name>Jane Doe</name> | ||
<affiliation>University of Knowledge</affiliation> | ||
</author> | ||
<journal> | ||
<name>Journal of Open Science</name> | ||
<year>2023</year> | ||
</journal> | ||
<doi>10.1234/jos.2023.001</doi> | ||
<license type="CC-BY">https://creativecommons.org/licenses/by/4.0/</license> | ||
<abstract> | ||
This paper explores the significance of open access in scientific research. | ||
</abstract>`; | ||
|
||
export const XML = { | ||
args: { | ||
code: sampleXML, | ||
language: 'xml', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters