Skip to content

Commit

Permalink
fix(Dropdown): Missing properties in PropTypes (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz authored May 10, 2022
1 parent f8a7795 commit 7a83b38
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
2 changes: 2 additions & 0 deletions packages/dnb-eufemia/src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import DrawerListContext from '../../fragments/drawer-list/DrawerListContext'
import DrawerListProvider from '../../fragments/drawer-list/DrawerListProvider'
import {
drawerListPropTypes,
drawerListProviderPropTypes,
parseContentTitle,
getCurrentData,
} from '../../fragments/drawer-list/DrawerListHelpers'
Expand All @@ -45,6 +46,7 @@ export default class Dropdown extends React.PureComponent {
static propTypes = {
...spacingPropTypes,
...drawerListPropTypes,
...drawerListProviderPropTypes,

id: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('Dropdown screenshot', () => {
},
})

it('have to match different item direactions', async () => {
it('have to match different item directions', async () => {
const screenshot = await testPageScreenshot({
style: {
'padding-top': '16rem',
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,28 @@ export const drawerListDefaultProps = {
options_render: null,
}

export const drawerListProviderPropTypes = {
enable_body_lock: PropTypes.bool,
use_drawer_on_mobile: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
]),
page_offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
observer_element: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]),
min_height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}

export const drawerListProviderDefaultProps = {
enable_body_lock: false,
use_drawer_on_mobile: null,
page_offset: null,
observer_element: null,
min_height: 10, // 10rem = 10x16=160,
}

export const parseContentTitle = (
dataItem,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
prepareDerivedState,
drawerListPropTypes,
drawerListDefaultProps,
drawerListProviderPropTypes,
drawerListProviderDefaultProps,
} from './DrawerListHelpers'
import DrawerListContext from './DrawerListContext'
import {
Expand All @@ -45,28 +47,13 @@ export default class DrawerListProvider extends React.PureComponent {

static propTypes = {
...drawerListPropTypes,

enable_body_lock: PropTypes.bool,
use_drawer_on_mobile: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
]),
page_offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
observer_element: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]),
min_height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
...drawerListProviderPropTypes,
children: PropTypes.node.isRequired,
}

static defaultProps = {
...drawerListDefaultProps,

enable_body_lock: false,
use_drawer_on_mobile: null,
page_offset: null,
observer_element: null,
min_height: 10, // 10rem = 10x16=160,
...drawerListProviderDefaultProps,
}

static blurDelay = 201 // some ms more than "DrawerListSlideDown 200ms"
Expand Down

0 comments on commit 7a83b38

Please sign in to comment.