-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kanban): add new item functionality to the first column
- Added showNewOnFirstColumn and newItemLabel props to Kanban component. - Updated Kanban styles to support new item addition. - Modified Column component to display a new item button when the first column is empty. - Updated mock data to include additional tasks. Ticket: task/Dashboards-135 Reviewed-by: @MIGUELez11 Refs: #176
- Loading branch information
Showing
5 changed files
with
201 additions
and
68 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
113 changes: 58 additions & 55 deletions
113
packages/components/src/informative/Kanban/Kanban.styles.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,58 +1,61 @@ | ||
import { createStyles } from '@mantine/styles'; | ||
|
||
export const KanbanStyles = createStyles((theme, {}) => { | ||
return { | ||
root: { | ||
overflow: 'auto', | ||
whiteSpace: 'nowrap', | ||
height: '100%', | ||
maxHeight: '100%', | ||
padding: theme.spacing[2], | ||
backgroundColor: '#F8F9FB', | ||
gap: theme.spacing[2], | ||
display: 'flex', | ||
const KanbanStyles = createStyles((theme) => ({ | ||
root: { | ||
display: 'flex', | ||
overflow: 'auto', | ||
whiteSpace: 'nowrap', | ||
height: '100%', | ||
maxHeight: '100%', | ||
gap: theme.spacing[2], | ||
alignItems: 'stretch', | ||
padding: theme.spacing[2], | ||
backgroundColor: '#F8F9FB', | ||
}, | ||
column: { | ||
display: 'inline-flex', | ||
position: 'relative', | ||
width: '300px', | ||
minWidth: '300px', | ||
flexDirection: 'column', | ||
backgroundColor: '#F2F4F8', | ||
borderRadius: theme.spacing[1], | ||
}, | ||
columnHeader: { | ||
paddingLeft: theme.spacing[4], | ||
paddingRight: theme.spacing[4], | ||
paddingTop: theme.spacing[3], | ||
color: '#4D5358', | ||
fontSize: '16px', | ||
fontWeight: 600, | ||
lineHeight: '24px', | ||
fontFamily: 'Albert Sans', | ||
display: 'flex', | ||
gap: theme.spacing[2], | ||
alignItems: 'center', | ||
}, | ||
scroll: { | ||
padding: theme.spacing[2], | ||
}, | ||
listDraggingOver: { | ||
backgroundColor: '#EDEFF5', | ||
borderRadius: 4, | ||
}, | ||
list: { | ||
minHeight: '100px', | ||
}, | ||
iconBig: { | ||
position: 'absolute', | ||
bottom: 20, | ||
left: 20, | ||
zIndex: 0, | ||
img: { | ||
filter: 'brightness(0) invert(1)', | ||
}, | ||
column: { | ||
height: '100%', | ||
display: 'inline-flex', | ||
position: 'relative', | ||
width: '300px', | ||
minWidth: '300px', | ||
flexDirection: 'column', | ||
backgroundColor: '#F2F4F8', | ||
borderRadius: theme.spacing[1], | ||
}, | ||
columnHeader: { | ||
paddingLeft: theme.spacing[4], | ||
paddingRight: theme.spacing[4], | ||
paddingTop: theme.spacing[3], | ||
color: '#4D5358', | ||
fontSize: '16px', | ||
fontWeight: 600, | ||
lineHeight: '24px', | ||
fontFamily: 'Albert Sans', | ||
display: 'flex', | ||
gap: theme.spacing[2], | ||
alignItems: 'center', | ||
}, | ||
scroll: { | ||
padding: theme.spacing[2], | ||
}, | ||
listDraggingOver: { | ||
backgroundColor: '#EDEFF5', | ||
borderRadius: 4, | ||
}, | ||
list: { | ||
minHeight: '100px', | ||
}, | ||
iconBig: { | ||
position: 'absolute', | ||
bottom: 20, | ||
left: 20, | ||
zIndex: 0, | ||
img: { | ||
filter: 'brightness(0) invert(1)', | ||
}, | ||
}, | ||
}; | ||
}); | ||
}, | ||
newItem: { | ||
padding: theme.spacing[2], | ||
}, | ||
})); | ||
|
||
export { KanbanStyles }; |
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
50 changes: 50 additions & 0 deletions
50
packages/components/src/informative/Kanban/components/NewItem.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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { noop, capitalize } from 'lodash'; | ||
import { AddCircleIcon } from '@bubbles-ui/icons/solid'; | ||
import { UnstyledButton, createStyles } from '@mantine/core'; | ||
import { Box } from '../../../layout/Box'; | ||
|
||
const useStyles = createStyles((theme) => ({ | ||
root: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
borderRadius: theme.other.global.border.radius.md, | ||
border: `2px dashed ${theme.other.dropzone.border.color.default}`, | ||
cursor: 'pointer', | ||
gap: 4, | ||
width: '100%', | ||
paddingBlock: theme.spacing[7], | ||
'&:hover': { | ||
backgroundColor: theme.other.dropzone.background.color.hover, | ||
}, | ||
}, | ||
label: { | ||
color: theme.other.global.content.color.text.default, | ||
...theme.other.global.content.typo.body['md--bold'], | ||
}, | ||
icon: { | ||
color: theme.other.global.content.color.icon.default, | ||
}, | ||
})); | ||
|
||
function NewItem({ label, onClick = noop }) { | ||
const { classes } = useStyles({}, { name: 'NewLibraryCardButton' }); | ||
return ( | ||
<UnstyledButton className={classes.root} onClick={onClick}> | ||
<Box className={classes.icon}> | ||
<AddCircleIcon width={24} height={24} /> | ||
</Box> | ||
<Box className={classes.label}>{capitalize(label)}</Box> | ||
</UnstyledButton> | ||
); | ||
} | ||
|
||
NewItem.propTypes = { | ||
label: PropTypes.string.isRequired, | ||
onClick: PropTypes.func.isRequired, | ||
}; | ||
|
||
export { NewItem }; |
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