Skip to content

Commit 78f3a3c

Browse files
philipjfulcherPhilip Fulcher
andauthored
chore(graph): remove global styles in favor of tailwind (#13882)
Co-authored-by: Philip Fulcher <philipfulcher@Philips-MacBook-Air.local>
1 parent b94c7e5 commit 78f3a3c

File tree

9 files changed

+34
-37
lines changed

9 files changed

+34
-37
lines changed

graph/client/.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../src/styles.scss';
1+
import '../src/styles.css';
22

33
import React from 'react';
44
import { MemoryRouter } from 'react-router-dom';

graph/client/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"main": "graph/client/src/main.tsx",
4040
"polyfills": "graph/client/src/polyfills.ts",
4141
"tsConfig": "graph/client/tsconfig.app.json",
42-
"styles": ["graph/client/src/styles.scss"],
42+
"styles": ["graph/client/src/styles.css"],
4343
"scripts": [],
4444
"assets": [],
4545
"webpackConfig": "graph/client/webpack.config.js",

graph/client/src/app/shell.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ export function Shell(): JSX.Element {
175175
) : null}
176176

177177
<div className="h-full w-full">
178-
<div className="h-full w-full" id="cytoscape-graph"></div>
178+
<div
179+
className="h-full w-full cursor-pointer"
180+
id="cytoscape-graph"
181+
></div>
179182
<TooltipDisplay></TooltipDisplay>
180183

181184
<Tooltip

graph/client/src/app/theme-resolver.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@ export let currentTheme: Theme;
77

88
function mediaListener(ev: MediaQueryListEvent) {
99
const resolver = ev.matches ? 'dark' : 'light';
10-
htmlEl.className = resolver;
10+
toggleHtmlClass(resolver);
1111
currentTheme = resolver;
1212
}
1313

14+
function toggleHtmlClass(theme: Theme) {
15+
if (theme === 'dark') {
16+
htmlEl.classList.add('dark');
17+
htmlEl.classList.remove('light');
18+
} else {
19+
htmlEl.classList.add('light');
20+
htmlEl.classList.remove('dark');
21+
}
22+
}
23+
1424
export function themeInit() {
1525
const theme =
1626
(localStorage.getItem(localStorageThemeKey) as Theme) ?? 'system';
@@ -25,13 +35,13 @@ export function themeResolver(theme: Theme) {
2535
const darkMedia = window.matchMedia('(prefers-color-scheme: dark)');
2636
if (theme !== 'system') {
2737
darkMedia.removeEventListener('change', mediaListener);
28-
htmlEl.className = theme;
38+
toggleHtmlClass(theme);
2939
currentTheme = theme;
3040
} else {
3141
const resolver = darkMedia.matches ? 'dark' : 'light';
3242

3343
darkMedia.addEventListener('change', mediaListener);
34-
htmlEl.className = resolver;
44+
toggleHtmlClass(resolver);
3545
currentTheme = resolver;
3646
}
3747

graph/client/src/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" class="h-full w-full overflow-hidden">
33
<head>
44
<meta charset="utf-8" />
55
<title>Nx Workspace Project Graph</title>
@@ -25,7 +25,9 @@
2525
</script>
2626
</head>
2727

28-
<body class="bg-white text-slate-500 dark:bg-slate-900 dark:text-slate-400">
29-
<div id="app"></div>
28+
<body
29+
class="h-full w-full overflow-hidden bg-white text-slate-500 dark:bg-slate-900 dark:text-slate-400"
30+
>
31+
<div class="flex h-full w-full overflow-hidden p-0" id="app"></div>
3032
</body>
3133
</html>

graph/client/src/styles.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@tailwind components;
2+
@tailwind base;
3+
@tailwind utilities;
4+
5+
/** Scrollbars **/
6+
.dark {
7+
color-scheme: dark;
8+
}

graph/client/src/styles.scss

Lines changed: 0 additions & 26 deletions
This file was deleted.

graph/ui-graph/src/lib/nx-project-graph-viz.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function NxProjectGraphViz({
114114
<div className="not-prose">
115115
<div
116116
ref={containerRef}
117-
className="w-full"
117+
className="w-full cursor-pointer"
118118
style={{ width: '100%', height }}
119119
></div>
120120
{tooltipToRender ? (

graph/ui-graph/src/lib/nx-task-graph-viz.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function NxTaskGraphViz({
9999
<div className="not-prose">
100100
<div
101101
ref={containerRef}
102-
className="w-full"
102+
className="w-full cursor-pointer"
103103
style={{ width: '100%', height }}
104104
></div>
105105
{tooltipToRender ? (

0 commit comments

Comments
 (0)