Skip to content

Commit

Permalink
feat(P): deprecate style_type property (#1855)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Feb 22, 2023
1 parent 9af5268 commit 74bc0ea
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,6 @@ exports[`GlobalError snapshot have to match component snapshot 1`] = `
modifier={null}
size={null}
small={null}
style_type={null}
>
<ForwardRef
as="p"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ exports[`Skeleton component have to match snapshot 1`] = `
modifier={null}
size={null}
small={null}
style_type={null}
>
<ForwardRef
as="p"
Expand Down
2 changes: 1 addition & 1 deletion packages/dnb-eufemia/src/elements/Ingress.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
import React from 'react'
import P from './P'

const Ingress = (p) => <P style_type="ingress" {...p} />
const Ingress = (p) => <P className="dnb-p--ingress" {...p} />
Ingress.tagName = 'dnb-p--ingress'
export default Ingress
2 changes: 1 addition & 1 deletion packages/dnb-eufemia/src/elements/Lead.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
import React from 'react'
import P from './P'

const Lead = (p) => <P style_type="lead" {...p} />
const Lead = (p) => <P className="dnb-p--lead" {...p} />
Lead.tagName = 'dnb-p--lead'
export default Lead
1 change: 0 additions & 1 deletion packages/dnb-eufemia/src/elements/P.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export interface PProps
medium?: boolean;
bold?: boolean;
size?: PSize;
style_type?: string;
modifier?: string;
children?: React.ReactNode;
}
Expand Down
7 changes: 0 additions & 7 deletions packages/dnb-eufemia/src/elements/P.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { spacingPropTypes } from '../components/space/SpacingHelper'
import E from './Element'

const P = ({
style_type,
modifier,
element,
className,
Expand All @@ -27,10 +26,6 @@ const P = ({
modifier = [modifier]
}

if (style_type) {
modifier.push(style_type) // deprecated
}

if (medium === true) {
modifier.push('medium')
} else if (bold === true) {
Expand Down Expand Up @@ -76,7 +71,6 @@ P.propTypes = {
'x-large',
'xx-large',
]),
style_type: PropTypes.string, // deprecated
modifier: PropTypes.string,
children: PropTypes.node,
}
Expand All @@ -87,7 +81,6 @@ P.defaultProps = {
medium: null,
bold: null,
size: null,
style_type: null, // deprecated
modifier: null,
children: null,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ exports[`P element have to match default P element snapshot 1`] = `
modifier="modifier"
size="x-small"
small={true}
style_type="style_type"
>
<ForwardRef
as="p"
className="dnb-p dnb-p--modifier dnb-p--style_type dnb-p--medium className dnb-p__size--x-small"
className="dnb-p dnb-p--modifier dnb-p--medium className dnb-p__size--x-small"
>
<ElementInstance
as="p"
className="dnb-p dnb-p--modifier dnb-p--style_type dnb-p--medium className dnb-p__size--x-small"
className="dnb-p dnb-p--modifier dnb-p--medium className dnb-p__size--x-small"
innerRef={null}
>
<p
className="dnb-p dnb-p--modifier dnb-p--style_type dnb-p--medium className dnb-p__size--x-small"
className="dnb-p dnb-p--modifier dnb-p--medium className dnb-p__size--x-small"
>
children
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ exports[`PaymentCard have to match snapshot 1`] = `
modifier="x-small bold"
size={null}
small={null}
style_type={null}
>
<ForwardRef
as="p"
Expand All @@ -256,7 +255,6 @@ exports[`PaymentCard have to match snapshot 1`] = `
modifier={null}
size={null}
small={null}
style_type={null}
>
<ForwardRef
as="p"
Expand Down

0 comments on commit 74bc0ea

Please sign in to comment.