Skip to content

Commit

Permalink
Add sass variable overrides to theme
Browse files Browse the repository at this point in the history
Necessary to style components that are not yet converted to Emotion (elastic/eui#5685)
  • Loading branch information
jonathonherbert committed Mar 30, 2023
1 parent 79573f9 commit 8722025
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 10 deletions.
184 changes: 184 additions & 0 deletions apps/rule-manager/client/package-lock.json

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

1 change: 1 addition & 0 deletions apps/rule-manager/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/react": "~17.0.53",
"@types/react-dom": "~17.0.19",
"@vitejs/plugin-react-swc": "^3.0.0",
"sass": "^1.60.0",
"typescript": "4.5",
"utility-types": "^3.10.0",
"vite": "^4.2.0"
Expand Down
6 changes: 6 additions & 0 deletions apps/rule-manager/client/src/css/theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* NB: Anything overridden in here must also be reflected in ts/constants/euiTheme.ts */
$euiBorderRadius: 0;
$euiBorderRadiusSmall: 0;
$euiFontFamily: 'Guardian Agate Sans', BlinkMacSystemFont, Helvetica, Arial, sans-serif;

@import "../../node_modules/@elastic/eui/src/themes/amsterdam/theme_light.scss";
9 changes: 3 additions & 6 deletions apps/rule-manager/client/src/ts/components/RulesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ const columns: Array<EuiBasicTableColumn<Rule>> = [
},
{
field: 'id',
name: 'ID',
render: (id: Rule['id']) => {
return <>{id}</>
}
name: 'ID'
},
{
field: 'category',
Expand Down Expand Up @@ -80,11 +77,11 @@ const RulesTable = () => {
<EuiFlexGroup>
<EuiFlexItem grow={false} css={css`padding-bottom: 20px`}>
<EuiTitle>
<h1>Current rules ({rules ? rules.length : 'loading...'})</h1>
<h1>Current rules</h1>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton fill={true} color={"primary"} onClick={() => refreshRules()} isLoading={isRefreshing}>
<EuiButton size="s" fill={true} color={"primary"} onClick={() => refreshRules()} isLoading={isRefreshing}>
Refresh{isRefreshing ? "ing" : ""} rules
</EuiButton>
</EuiFlexItem>
Expand Down
1 change: 0 additions & 1 deletion apps/rule-manager/client/src/ts/components/pages/Rules.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import '@elastic/eui/dist/eui_theme_light.css';
import {EuiPageSection} from "@elastic/eui";
import RulesTable from "../RulesTable";

Expand Down
7 changes: 7 additions & 0 deletions apps/rule-manager/client/src/ts/constants/euiTheme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
/* NB: Anything overridden in here must also be reflected in styles/theme.scss */
export const euiThemeOverrides = {
"font": {
"family": "'Guardian Agate Sans', BlinkMacSystemFont, Helvetica, Arial, sans-serif"
},
"border": {
"radius": {
"small": "0",
"medium": "0"
}
}
};
8 changes: 5 additions & 3 deletions apps/rule-manager/client/src/ts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import {Page} from "./components/layout/Page";
import "../css/theme.scss";
import "../css/reset.css";
import "../css/typography.css";
import "./constants/icons";

import * as React from "react";
import * as ReactDOM from "react-dom";
import {Page} from "./components/layout/Page";

// For development mode with Vite
import 'vite/modulepreload-polyfill';

Expand Down

0 comments on commit 8722025

Please sign in to comment.