-
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.
feat: enhance #icon sizing. Also show primary icon under components
- Loading branch information
1 parent
6888b5c
commit c490550
Showing
15 changed files
with
124 additions
and
91 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
2 changes: 1 addition & 1 deletion
2
packages/dnb-design-system-portal/src/pages/uilib/components/icon-primary.md
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: 'IconPrimary' | ||
draft: true | ||
draft: false | ||
status: null | ||
order: 5 | ||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
packages/dnb-design-system-portal/src/pages/uilib/components/input-masked.md
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: 'InputMasked' | ||
draft: true | ||
draft: false | ||
status: null | ||
order: 7 | ||
--- | ||
|
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
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
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
56 changes: 52 additions & 4 deletions
56
packages/dnb-ui-lib/src/components/icon-primary/IconPrimary.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 |
---|---|---|
@@ -1,8 +1,56 @@ | ||
/** | ||
* Button Component | ||
* Web Icon Component | ||
* | ||
*/ | ||
|
||
import IconPrimary from '../icon/IconPrimary' | ||
export default IconPrimary | ||
export * from '../icon/IconPrimary' | ||
import React, { PureComponent } from 'react' | ||
import PropTypes from 'prop-types' | ||
import DefaultIcon, { DefaultIconSize, loadSVG } from '../icon/Icon' | ||
import * as primary_icons from '../../icons/primary_icons' | ||
import * as primary_icons_medium from '../../icons/primary_icons_medium' | ||
|
||
const icons = { ...primary_icons, ...primary_icons_medium } | ||
|
||
export { DefaultIconSize } | ||
export const propTypes = { | ||
...DefaultIcon.propTypes, | ||
...{ | ||
icon: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.node, | ||
PropTypes.func | ||
]) | ||
} | ||
} | ||
|
||
export const defaultProps = { ...DefaultIcon.defaultProps } | ||
|
||
export default class IconPrimary extends PureComponent { | ||
static tagName = 'dnb-icon-primary' | ||
static propTypes = propTypes | ||
static defaultProps = defaultProps | ||
|
||
static enableWebComponent() { | ||
DefaultIcon.enableWebComponent(IconPrimary.tagName, IconPrimary) | ||
} | ||
|
||
static getIcon(props) { | ||
return DefaultIcon.getIcon(props) | ||
} | ||
|
||
render() { | ||
const { icon, wrapperParams, svgParams, size } = DefaultIcon.prerender( | ||
this.props | ||
) | ||
|
||
const Svg = loadSVG(icon, size, icons) | ||
|
||
if (!Svg) return <></> | ||
|
||
return ( | ||
<span {...wrapperParams}> | ||
<Svg {...svgParams} /> | ||
</span> | ||
) | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -1,56 +1,8 @@ | ||
/** | ||
* Web Icon Component | ||
* Primary Icon (Symlinc) Web Component | ||
* | ||
*/ | ||
|
||
import React, { PureComponent } from 'react' | ||
import PropTypes from 'prop-types' | ||
import DefaultIcon, { DefaultIconSize, loadSVG } from './Icon' | ||
import * as primary_icons from '../../icons/primary_icons' | ||
import * as primary_icons_medium from '../../icons/primary_icons_medium' | ||
|
||
const icons = { ...primary_icons, ...primary_icons_medium } | ||
|
||
export { DefaultIconSize } | ||
export const propTypes = { | ||
...DefaultIcon.propTypes, | ||
...{ | ||
icon: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.node, | ||
PropTypes.func | ||
]) | ||
} | ||
} | ||
|
||
export const defaultProps = { ...DefaultIcon.defaultProps } | ||
|
||
export default class IconPrimary extends PureComponent { | ||
static tagName = 'dnb-icon-primary' | ||
static propTypes = propTypes | ||
static defaultProps = defaultProps | ||
|
||
static enableWebComponent() { | ||
DefaultIcon.enableWebComponent(IconPrimary.tagName, IconPrimary) | ||
} | ||
|
||
static getIcon(props) { | ||
return DefaultIcon.getIcon(props) | ||
} | ||
|
||
render() { | ||
const { icon, wrapperParams, svgParams, size } = DefaultIcon.prerender( | ||
this.props | ||
) | ||
|
||
const Svg = loadSVG(icon, size, icons) | ||
|
||
if (!Svg) return <></> | ||
|
||
return ( | ||
<span {...wrapperParams}> | ||
<Svg {...svgParams} /> | ||
</span> | ||
) | ||
} | ||
} | ||
import IconPrimary from '../icon-primary/IconPrimary' | ||
export default IconPrimary | ||
export * from '../icon-primary/IconPrimary' |
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
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
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