Skip to content

Commit

Permalink
Make lane collapsible individually
Browse files Browse the repository at this point in the history
- Make it possible to pass the initial collapse state
  • Loading branch information
florianbarbin committed Jan 30, 2024
1 parent 9ca7b07 commit d13b712
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ObeoNetwork/react-trello",
"version": "2.4.4",
"version": "2.4.5",
"description": "Pluggable components to add a trello like kanban board to your application",
"main": "dist/index.js",
"files": [
Expand Down
5 changes: 3 additions & 2 deletions src/controllers/BoardContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ class BoardContainer extends Component {
'draggable',
'laneDraggable',
'cardDraggable',
'collapsibleLanes',
'canAddLanes',
'hideCardDeleteIcon',
'tagStyle',
Expand All @@ -189,7 +188,7 @@ class BoardContainer extends Component {
getChildPayload={index => this.getLaneDetails(index)}
groupName={this.groupName}>
{reducerData.lanes.map((lane, index) => {
const {id, droppable, ...otherProps} = lane
const {id, droppable, collapsible, collapsed, ...otherProps} = lane
const laneToRender = (
<Lane
key={id}
Expand All @@ -203,6 +202,8 @@ class BoardContainer extends Component {
labelStyle={lane.labelStyle || {}}
cardStyle={this.props.cardStyle || lane.cardStyle}
editable={editable && !lane.disallowAddingCard}
collapsible={collapsibleLanes || collapsible}
collapsed={collapsed}
{...otherProps}
{...passthroughProps}
/>
Expand Down
12 changes: 7 additions & 5 deletions src/controllers/Lane.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Lane extends Component {
loading: false,
currentPage: this.props.currentPage,
addCardMode: false,
collapsed: false,
collapsed: this.props.collapsed,
isDraggingOver: false
}

Expand Down Expand Up @@ -235,15 +235,15 @@ class Lane extends Component {
}

toggleLaneCollapsed = () => {
this.props.collapsibleLanes && this.setState(state => ({collapsed: !state.collapsed}))
this.props.collapsible && this.setState(state => ({collapsed: !state.collapsed}))
}

render() {
const {loading, isDraggingOver, collapsed} = this.state
const {
id,
cards,
collapsibleLanes,
collapsible,
components,
onLaneClick,
onLaneScroll,
Expand Down Expand Up @@ -271,10 +271,11 @@ class Lane extends Component {
droppable,
editable,
editLaneTitle,
collapsed: collapsedProps,
...otherProps
} = this.props
const allClassNames = classNames('react-trello-lane', this.props.className || '')
const showFooter = collapsibleLanes && cards.length > 0
const showFooter = collapsible && cards.length > 0
return (
<components.Section
{...otherProps}
Expand Down Expand Up @@ -318,7 +319,8 @@ Lane.propTypes = {
label: PropTypes.string,
currentPage: PropTypes.number,
draggable: PropTypes.bool,
collapsibleLanes: PropTypes.bool,
collapsible: PropTypes.bool,
collapsed: PropTypes.bool,
droppable: PropTypes.bool,
onCardMoveAcrossLanes: PropTypes.func,
onCardClick: PropTypes.func,
Expand Down

0 comments on commit d13b712

Please sign in to comment.