Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Commit a5f6095

Browse files
Merge pull request #818 from intellihr/release/368
Release 368
2 parents 7265b44 + c35ae37 commit a5f6095

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@intellihr/ui-components",
33
"description": "A common React components library that is used in our company",
4-
"version": "47.0.2",
4+
"version": "47.0.3",
55
"main": "./dist/",
66
"types": "./types/index.d.ts",
77
"files": [

src/domain/Lists/DraggableList/DraggableList.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from 'react-beautiful-dnd'
88

99
import { Props } from '../../../common'
10-
import { StyledListArea, StyledListItem } from './style'
10+
import { StyledDraggableList, StyledListArea, StyledListItem } from './style'
1111

1212
interface IDraggableListProps<T> {
1313
/** Droppable area id - this allows us to have more than one per page */
@@ -16,11 +16,13 @@ interface IDraggableListProps<T> {
1616
setItems: React.Dispatch<React.SetStateAction<T[]>>
1717
/** An array of ReactElements that should represent the array of items */
1818
children: React.ReactElement[]
19+
/** The margins around the component */
20+
margins?: Props.IMargins
1921
/** The data-component-context */
2022
componentContext?: string
2123
}
2224

23-
const DraggableList = <T extends {}> ({ droppableId, setItems, children, componentContext }: IDraggableListProps<T>) => {
25+
const DraggableList = <T extends {}> ({ droppableId, setItems, children, margins, componentContext }: IDraggableListProps<T>) => {
2426
const onDragEnd = (result: DropResult) => {
2527
if (!result.destination) {
2628
return
@@ -36,7 +38,8 @@ const DraggableList = <T extends {}> ({ droppableId, setItems, children, compone
3638
}
3739

3840
return (
39-
<span
41+
<StyledDraggableList
42+
margins={margins}
4043
data-component-type={Props.ComponentType.DraggableList}
4144
data-component-context={componentContext}
4245
>
@@ -83,7 +86,7 @@ const DraggableList = <T extends {}> ({ droppableId, setItems, children, compone
8386
)}
8487
</Droppable>
8588
</DragDropContext>
86-
</span>
89+
</StyledDraggableList>
8790
)
8891
}
8992

src/domain/Lists/DraggableList/style.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import styled, { css } from 'styled-components'
22

3-
import { Variables } from '../../../common'
3+
import { Props, Variables } from '../../../common'
4+
import { styleForMargins } from '../../Spacers/services/margins'
45

56
interface IListItemProps {
67
isDragging: boolean
78
children: React.ReactNode
89
}
910

11+
interface IStyledDraggableListProps {
12+
margins?: Props.IMargins
13+
}
14+
1015
const StyledListItem = styled.div<IListItemProps>`
1116
border: 1px solid ${Variables.Color.n250};
1217
background-color: ${Variables.Color.n100};
@@ -29,7 +34,11 @@ const StyledListArea = styled.div`
2934
}
3035
`
3136

37+
const StyledDraggableList = styled.div`
38+
${(props: IStyledDraggableListProps) => styleForMargins(props.margins)}
39+
`
3240
export {
3341
StyledListArea,
34-
StyledListItem
42+
StyledListItem,
43+
StyledDraggableList
3544
}

0 commit comments

Comments
 (0)