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

fix: Fix the dark theme in ThreatModel Print Preview page #124

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/threat-composer-app/.projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/threat-composer-app/.projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/threat-composer-app/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************************************************** */
/** @jsxImportSource @emotion/react */
import { ThreatModelView } from '@aws/threat-composer';
import Box from '@cloudscape-design/components/box';
import { Container } from '@cloudscape-design/components';
import * as awsui from '@cloudscape-design/design-tokens';
import { css } from '@emotion/react';
import { FC, useEffect, useMemo } from 'react';
import { useParams } from 'react-router-dom';

const styles = {
container: css({
'background': awsui.colorBackgroundContainerContent,
'width': '100vw',
'height': '100vh',
'&>div': {
border: 'none !important',
borderRadius: '0px !important',
boxShadow: 'none !important',
},
}),
};

const ThreatModelPreview: FC = () => {
const { dataKey } = useParams();

Expand All @@ -37,11 +53,11 @@ const ThreatModelPreview: FC = () => {
};
}, [dataKey]);

if (!data) {
return <Box>No content</Box>;
}

return <ThreatModelView composerMode='Full' data={data} isPreview />;
return (<div css={styles.container}>
<Container>
{data ? <ThreatModelView composerMode='Full' data={data} isPreview /> : <div>No content</div>}
</Container>
</div>);
};

export default ThreatModelPreview;
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ import { css } from '@emotion/react';
import { useThemeContext } from '../ThemeProvider';

const styles = {
container: css({
height: '100%',
display: 'flex',
alignItems: 'center',
}),
svg: css({
color: 'grey !important',
fill: 'grey !important',
Expand All @@ -35,7 +30,7 @@ const styles = {

const ThemeToggle = () => {
const { theme, setTheme } = useThemeContext();
return (<div css={styles.container}>
return (<div>
<SpaceBetween direction="horizontal" size="xs">
<Toggle
onChange={({ detail }) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************************************************** */
/** @jsxImportSource @emotion/react */

import DeleteConfirmationDialog from '@aws-northstar/ui/components/DeleteConfirmationDialog';
import Alert from '@cloudscape-design/components/alert';
import Button from '@cloudscape-design/components/button';
Expand All @@ -25,6 +27,7 @@ import {
} from '@cloudscape-design/components/internal/events';
import Select, { SelectProps } from '@cloudscape-design/components/select';
import SpaceBetween from '@cloudscape-design/components/space-between';
import { css } from '@emotion/react';
import { FC, useMemo, useState, useCallback, PropsWithChildren } from 'react';
import { APP_MODE_IDE_EXTENSION } from '../../../configs';
import {
Expand All @@ -41,11 +44,23 @@ import {
} from '../../../customTypes';
import useImportExport from '../../../hooks/useExportImport';
import useRemoveData from '../../../hooks/useRemoveData';
import getMobileMediaQuery from '../../../utils/getMobileMediaQuery';
import isWorkspaceExample from '../../../utils/isWorkspaceExample';
import ThemeToggle from '../../generic/ThemeToggle';
import EditWorkspace from '../../workspaces/EditWorkspace';
import FileImport from '../../workspaces/FileImport';

const styles = {
themeToggle: css({
height: '100%',
display: 'flex',
alignItems: 'center',
[getMobileMediaQuery()]: {
display: 'none',
},
}),
};

export interface WorkspaceSelectorProps {
embededMode: boolean;
enabledExportAll?: boolean;
Expand Down Expand Up @@ -360,7 +375,7 @@ const WorkspaceSelector: FC<PropsWithChildren<WorkspaceSelectorProps>> = ({
onItemClick={handleMoreActions}
/>
)}
{appMode !== 'ide-extension' && composerMode === 'Full' && <ThemeToggle />}
{appMode !== 'ide-extension' && composerMode === 'Full' && <div css={styles.themeToggle}><ThemeToggle /></div>}
</SpaceBetween>
{fileImportModalVisible && (
<FileImport
Expand Down
1 change: 1 addition & 0 deletions projenrc/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ThreatComposerReactAppProject extends ReactTypeScriptProject {
"@cloudscape-design/global-styles",
"@cloudscape-design/design-tokens",
"@aws-northstar/ui",
"@emotion/react",
"@uidotdev/usehooks",
"react-router-dom",
"uuid",
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading