-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance portal dnb theme and make code components for more flexibility
- Loading branch information
1 parent
53c4e22
commit 619e8f9
Showing
5 changed files
with
213 additions
and
159 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
22 changes: 22 additions & 0 deletions
22
packages/dnb-design-system-portal/src/shared/inlineTags/ComponentBox.js
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,22 @@ | ||
/** | ||
* Inline Tag | ||
* | ||
*/ | ||
|
||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import CodeBlock from './CodeBlock' | ||
import { getComponents } from 'dnb-ui-lib/src/components' | ||
|
||
const ComponentBox = ({ children, ...rest }) => { | ||
return ( | ||
<CodeBlock scope={getComponents()} {...rest}> | ||
{children} | ||
</CodeBlock> | ||
) | ||
} | ||
ComponentBox.propTypes = { | ||
children: PropTypes.node.isRequired | ||
} | ||
|
||
export default ComponentBox |
27 changes: 27 additions & 0 deletions
27
packages/dnb-design-system-portal/src/shared/inlineTags/ExampleBox.js
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,27 @@ | ||
/** | ||
* Inline Tag | ||
* | ||
*/ | ||
|
||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const ExampleBox = ({ children, caption, ...rest }) => { | ||
return ( | ||
<> | ||
<div className="example-box" {...rest}> | ||
{children} | ||
</div> | ||
{caption && <p className="example-caption">{caption}</p>} | ||
</> | ||
) | ||
} | ||
ExampleBox.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
caption: PropTypes.string | ||
} | ||
ExampleBox.defaultProps = { | ||
caption: null | ||
} | ||
|
||
export default ExampleBox |
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
Oops, something went wrong.