Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cb 3963 migrate core view to css modules #2192

Merged
merged 21 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
edfd4ad
CB-3963 error message reshadow refactor
Dec 1, 2023
0a04d60
CB-3963 remove extra reshadow use from ItemListSearch
Dec 1, 2023
1c0dbb1
CB-3963 remove reshadow from TopAppBar
Dec 1, 2023
e4e1e17
CB-3963 remove unused LoadingScreen component
Dec 1, 2023
8293cd4
CB-3963 removed reshadow from VersionUpdate
Dec 1, 2023
8ba210b
CB-3963 removed reshadow from VersionSelector
Dec 1, 2023
bcbfd7e
CB-3963 removed reshadow from renderLayout
Dec 1, 2023
d5828c2
CB-3963 removed reshadow from AuthenticationProvider
Dec 1, 2023
c8d29fe
CB-3963 removed reshadow from VersionInfo
Dec 1, 2023
da688df
CB-3963 removed reshadow from TableItemSelect
Dec 2, 2023
b4d31d3
CB-3963 removed reshadow from CaptureView
Dec 4, 2023
6953e6f
CB-3963 removed reshadow from ConnectionList
Dec 4, 2023
df585f1
Merge branch 'devel' into CB-3963-migrate-core-view-to-css-modules
Dec 4, 2023
f0e5e63
CB-3963 removed reshadow from WizzardStepper
Dec 4, 2023
a09c63d
CB-3963 removed reshadow from ConfigurationWizardTittle
Dec 4, 2023
fc518b2
Revert "CB-3963 removed reshadow from AuthenticationProvider"
Dec 4, 2023
ad9cebd
Merge branch 'devel' into CB-3963-migrate-core-view-to-css-modules
mr-anton-t Dec 5, 2023
9b728ae
Merge branch 'devel' into CB-3963-migrate-core-view-to-css-modules
mr-anton-t Dec 6, 2023
ca378a4
CB.3963 fix checkboxes margin in table items
Dec 6, 2023
b561a8f
Merge branch 'devel' into CB-3963-migrate-core-view-to-css-modules
mr-anton-t Dec 8, 2023
c6dd052
Merge branch 'devel' into CB-3963-migrate-core-view-to-css-modules
mr-anton-t Dec 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions webapp/packages/core-blocks/src/ErrorMessage.m.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.message {
box-sizing: border-box;
display: flex;
align-items: center;
border-radius: var(--theme-group-element-radius);
height: 50px;
padding: 8px 12px;
}

.errorIcon {
width: 24px;
height: 24px;
margin-right: 8px;
}

.messageBody {
composes: theme-typography--body2 from global;
max-height: 100%;
line-height: 1.2;
box-sizing: border-box;
flex: 1;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
}

.messageActions {
margin-left: 16px;
}
51 changes: 11 additions & 40 deletions webapp/packages/core-blocks/src/ErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,13 @@
* you may not use this file except in compliance with the License.
*/
import { observer } from 'mobx-react-lite';
import styled, { css } from 'reshadow';

import { Button } from './Button';
import { IconOrImage } from './IconOrImage';
import { useTranslate } from './localization/useTranslate';
import { useS } from './useS';

const styles = css`
message {
box-sizing: border-box;
display: flex;
align-items: center;
border-radius: var(--theme-group-element-radius);
height: 50px;
padding: 8px 12px;
}

IconOrImage {
width: 24px;
height: 24px;
margin-right: 8px;
}

message-body {
composes: theme-typography--body2 from global;
max-height: 100%;
line-height: 1.2;
box-sizing: border-box;
flex: 1;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
}
message-actions {
margin-left: 16px;
}
`;
import styles from './ErrorMessage.m.css';
import { s } from './s';

interface Props {
hasDetails?: boolean;
Expand All @@ -53,18 +23,19 @@ interface Props {

export const ErrorMessage = observer<Props>(function ErrorMessage({ text, className, hasDetails, onShowDetails }) {
const translate = useTranslate();
const style = useS(styles);

return styled(styles)(
<message className={className}>
<IconOrImage icon="/icons/error_icon_sm.svg" />
<message-body title={text}>{text}</message-body>
<message-actions>
return (
<div className={s(style, { message: true }, className)}>
<IconOrImage className={s(style, { errorIcon: true })} icon="/icons/error_icon_sm.svg" />
<div className={s(style, { messageBody: true })} title={text}>{text}</div>
<div className={s(style, { messageActions: true })}>
{hasDetails && (
<Button type="button" mod={['outlined']} onClick={onShowDetails}>
{translate('ui_errors_details')}
</Button>
)}
</message-actions>
</message>,
</div>
</div>
);
});
2 changes: 0 additions & 2 deletions webapp/packages/core-blocks/src/ItemList/ItemListSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* you may not use this file except in compliance with the License.
*/
import { useCallback, useRef, useState } from 'react';
import { use } from 'reshadow';

import { IconButton } from '../IconButton';
import { useTranslate } from '../localization/useTranslate';
Expand Down Expand Up @@ -67,7 +66,6 @@ export const ItemListSearch: React.FC<IProps> = function ItemListSearch({ value,
autoComplete="off"
disabled={disabled}
onChange={event => changeHandler(event.target.value)}
{...use({ mod: 'surface' })}
/>
<div className={s(styles, { actionButton: true })}>
{!onSearch && inputValue ? (
Expand Down
34 changes: 0 additions & 34 deletions webapp/packages/core-blocks/src/LoadingScreen/LoadingScreen.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions webapp/packages/core-blocks/src/LoadingScreen/loading-screen.css

This file was deleted.

1 change: 0 additions & 1 deletion webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* you may not use this file except in compliance with the License.
*/
import { observer } from 'mobx-react-lite';
import styled, { css } from 'reshadow';

import { Icon } from '../Icon';
import { s } from '../s';
Expand Down
4 changes: 4 additions & 0 deletions webapp/packages/core-blocks/src/Table/TableItemSelect.m.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.checkbox {
margin-left: -10px;
margin-right: -10px;
}
22 changes: 12 additions & 10 deletions webapp/packages/core-blocks/src/Table/TableItemSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
*/
import { observer } from 'mobx-react-lite';
import { useContext } from 'react';
import styled, { css } from 'reshadow';

import { EventContext } from '@cloudbeaver/core-events';

import { Checkbox } from '../FormControls/Checkboxes/Checkbox';
import { EventTableItemSelectionFlag } from './EventTableItemSelectionFlag';
import { TableContext } from './TableContext';
import { TableItemContext } from './TableItemContext';
import { useS } from '../useS';
import styles from './TableItemSelect.m.css';
import { s } from '../s';

interface Props {
checked?: boolean;
Expand All @@ -23,17 +25,11 @@ interface Props {
className?: string;
}

const styles = css`
Checkbox {
margin-left: -10px;
margin-right: -10px;
}
`;

export const TableItemSelect = observer<Props>(function TableItemSelect({ checked, disabled, tooltip, className }) {
const tableContext = useContext(TableContext);
const context = useContext(TableItemContext);
const selected = checked ?? context?.isSelected();
const style = useS(styles);

function handleClick(event: React.MouseEvent<HTMLInputElement>) {
if (!context) {
Expand All @@ -48,7 +44,13 @@ export const TableItemSelect = observer<Props>(function TableItemSelect({ checke
return null;
}

return styled(styles)(
<Checkbox className={className} title={tooltip} disabled={context.selectDisabled || disabled} checked={selected} onClick={handleClick} />,
return (
<Checkbox
className={s(style, { checkbox: true }, className)}
title={tooltip}
disabled={context.selectDisabled || disabled}
checked={selected}
onClick={handleClick}
/>
);
});
10 changes: 10 additions & 0 deletions webapp/packages/core-blocks/src/layout/TopAppBar.m.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.header {
composes: theme-text-on-primary theme-typography--body2 from global;
display: flex;
align-items: center;
height: 48px;
padding: 0 8px;
background-color: #2a7cb4;
z-index: 1;
flex-shrink: 0;
}
20 changes: 6 additions & 14 deletions webapp/packages/core-blocks/src/layout/TopAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,17 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import styled, { css } from 'reshadow';

export const topAppBarStyles = css`
header {
composes: theme-text-on-primary theme-typography--body2 from global;
display: flex;
align-items: center;
height: 48px;
padding: 0 8px;
background-color: #2a7cb4;
z-index: 1;
flex-shrink: 0;
}
`;
import { s } from '../s';
import { useS } from '../useS';
import styles from './TopAppBar.m.css';

interface Props extends React.PropsWithChildren {
className?: string;
}

export const TopAppBar: React.FC<Props> = function TopAppBar({ children, className }) {
return styled(topAppBarStyles)(<header className={className}>{children}</header>);
const style = useS(styles);

return (<header className={s(style, { header: true }, className)}>{children}</header>);
};
3 changes: 3 additions & 0 deletions webapp/packages/core-bootstrap/src/renderLayout.m.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.loader {
height: 100vh;
}
14 changes: 5 additions & 9 deletions webapp/packages/core-bootstrap/src/renderLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*/
import { Suspense } from 'react';
import { createRoot, Root } from 'react-dom/client';
import styled from 'reshadow';

import { Body } from '@cloudbeaver/core-app';
import { DisplayError, ErrorBoundary, Loader } from '@cloudbeaver/core-blocks';
import { DisplayError, ErrorBoundary, Loader, s } from '@cloudbeaver/core-blocks';
import { AppContext, IServiceInjector } from '@cloudbeaver/core-di';
import styles from './renderLayout.m.css';

interface IRender {
initRoot(): Root;
Expand Down Expand Up @@ -46,18 +46,14 @@ export function renderLayout(serviceInjector: IServiceInjector): IRender {
},
renderApp() {
this.initRoot().render(
styled`
Loader {
height: 100vh;
}
`(
(
<AppContext app={serviceInjector}>
<ErrorBoundary root>
<Suspense fallback={<Loader />}>
<Suspense fallback={<Loader className={s(styles, { loader: true })} />}>
<Body />
</Suspense>
</ErrorBoundary>
</AppContext>,
</AppContext>
),
);
},
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-view/src/View/CaptureView.m.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.container {
outline: none;
}
Loading
Loading