diff --git a/webapp/packages/core-blocks/src/Flex/Flex.module.css b/webapp/packages/core-blocks/src/Flex/Flex.module.css new file mode 100644 index 0000000000..cbc9739dba --- /dev/null +++ b/webapp/packages/core-blocks/src/Flex/Flex.module.css @@ -0,0 +1,100 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +.flex { + display: flex; + flex: 1 1 100%; + + &.overflow { + overflow: auto; + } + + &[data-s-gap='xs'] { + gap: 8px; + } + + &[data-s-gap='md'] { + gap: 16px; + } + + &[data-s-gap='lg'] { + gap: 24px; + } + + &[data-s-wrap='wrap'] { + flex-wrap: wrap; + } + + &[data-s-wrap='nowrap'] { + flex-wrap: nowrap; + } + + &[data-s-wrap='wrap-reverse'] { + flex-wrap: wrap-reverse; + } + + &[data-s-direction='row'] { + flex-direction: row; + } + + &[data-s-direction='column'] { + flex-direction: column; + } + + &[data-s-direction='row-reverse'] { + flex-direction: row-reverse; + } + + &[data-s-direction='column-reverse'] { + flex-direction: column-reverse; + } + + &[data-s-align='start'] { + align-items: flex-start; + } + + &[data-s-align='center'] { + align-items: center; + } + + &[data-s-align='end'] { + align-items: flex-end; + } + + &[data-s-align='stretch'] { + align-items: stretch; + } + + &[data-s-justify='start'] { + justify-content: flex-start; + } + + &[data-s-justify='center'] { + justify-content: center; + } + + &[data-s-justify='end'] { + justify-content: flex-end; + } + + &[data-s-justify='space-between'] { + justify-content: space-between; + } + + &[data-s-justify='space-around'] { + justify-content: space-around; + } + + &[data-s-justify='space-evenly'] { + justify-content: space-evenly; + } + + &[data-s-justify='stretch'] { + justify-content: stretch; + } +} diff --git a/webapp/packages/core-blocks/src/Flex/Flex.tsx b/webapp/packages/core-blocks/src/Flex/Flex.tsx new file mode 100644 index 0000000000..6fc22b164b --- /dev/null +++ b/webapp/packages/core-blocks/src/Flex/Flex.tsx @@ -0,0 +1,40 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +import { forwardRef } from 'react'; + +import { s } from '../s'; +import classes from './Flex.module.css'; + +interface Props extends React.HTMLAttributes { + overflow?: boolean; + gap?: 'xs' | 'md' | 'lg'; + wrap?: React.CSSProperties['flexWrap']; + direction?: React.CSSProperties['flexDirection']; + align?: React.CSSProperties['alignItems']; + justify?: React.CSSProperties['justifyContent']; +} + +export const Flex = forwardRef(function Flex( + { overflow, gap, wrap, direction, align, justify, className, children, ...rest }, + ref, +) { + return ( +
+ {children} +
+ ); +}); diff --git a/webapp/packages/core-blocks/src/index.ts b/webapp/packages/core-blocks/src/index.ts index 8ccb413fa2..6dd8a53241 100644 --- a/webapp/packages/core-blocks/src/index.ts +++ b/webapp/packages/core-blocks/src/index.ts @@ -250,3 +250,4 @@ export * from './manifest'; export * from './importLazyComponent'; export * from './ClickableLoader'; export * from './FormControls/TagsComboboxLoader'; +export * from './Flex/Flex'; diff --git a/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScripts.tsx b/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScripts.tsx index 29078cd208..6e1d4c17e9 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScripts.tsx +++ b/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScripts.tsx @@ -7,7 +7,7 @@ */ import { observer } from 'mobx-react-lite'; -import { Container, useTranslate } from '@cloudbeaver/core-blocks'; +import { Flex, useTranslate } from '@cloudbeaver/core-blocks'; import type { TabContainerPanelComponent } from '@cloudbeaver/core-ui'; import { ResourceManagerTree } from '@cloudbeaver/plugin-navigation-tree-rm'; @@ -17,10 +17,10 @@ export const ResourceManagerScripts: TabContainerPanelComponent = observer(funct const translate = useTranslate(); return ( - + {translate('plugin_resource_manager_scripts_no_resources_placeholder')} - + ); });