-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: Add new components for row and column layouts
Both components are based on mantine and flexbox. They are intended to replace Layout especially in dialogs.
- Loading branch information
1 parent
b18c422
commit cf751df
Showing
2 changed files
with
92 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import {Flex} from '@mantine/core'; | ||
|
||
import PropTypes from 'web/utils/proptypes'; | ||
|
||
/** | ||
* React component that renders a stack (column) layout | ||
* | ||
*/ | ||
const Column = ({ | ||
children, | ||
gap = 'md', | ||
grow, | ||
align = 'stretch', | ||
wrap, | ||
justify = 'flex-start', | ||
...props | ||
}) => { | ||
return ( | ||
<Flex | ||
{...props} | ||
direction="column" | ||
gap={gap} | ||
grow={grow} | ||
align={align} | ||
wrap={wrap} | ||
justify={justify} | ||
> | ||
{children} | ||
</Flex> | ||
); | ||
}; | ||
|
||
Column.propTypes = { | ||
align: PropTypes.string, | ||
gap: PropTypes.string, | ||
grow: PropTypes.numberOrNumberString, | ||
justify: PropTypes.string, | ||
wrap: PropTypes.string, | ||
}; | ||
|
||
export default Column; |
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,46 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import {Flex} from '@mantine/core'; | ||
|
||
import PropTypes from 'web/utils/proptypes'; | ||
|
||
/** | ||
* React component that renders a row layout | ||
* | ||
*/ | ||
const Row = ({ | ||
children, | ||
gap = 'md', | ||
grow, | ||
align = 'center', | ||
wrap, | ||
justify, | ||
...props | ||
}) => { | ||
return ( | ||
<Flex | ||
{...props} | ||
direction="row" | ||
gap={gap} | ||
grow={grow} | ||
align={align} | ||
wrap={wrap} | ||
justify={justify} | ||
> | ||
{children} | ||
</Flex> | ||
); | ||
}; | ||
|
||
Row.propTypes = { | ||
align: PropTypes.string, | ||
gap: PropTypes.string, | ||
grow: PropTypes.numberOrNumberString, | ||
justify: PropTypes.string, | ||
wrap: PropTypes.string, | ||
}; | ||
|
||
export default Row; |