Skip to content

Commit

Permalink
Removes UITK variant
Browse files Browse the repository at this point in the history
  • Loading branch information
origami-z committed Apr 4, 2024
1 parent e94680a commit 47dec79
Show file tree
Hide file tree
Showing 43 changed files with 522 additions and 1,515 deletions.
400 changes: 0 additions & 400 deletions packages/ag-grid-theme/css/uitk-ag-grid-theme.css

This file was deleted.

229 changes: 0 additions & 229 deletions packages/ag-grid-theme/css/uitk-icons.css

This file was deleted.

1 change: 0 additions & 1 deletion packages/ag-grid-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"style": "salt-ag-theme.css",
"files": [
"/fonts",
"/uitk-ag-theme.css",
"/salt-ag-theme.css"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ag-grid-theme/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ deleteSync([buildFolder], { force: true });
esbuild
.build({
absWorkingDir: path.resolve(__dirname, ".."),
entryPoints: ["salt-ag-theme.css", "uitk-ag-theme.css"],
entryPoints: ["salt-ag-theme.css"],
assetNames: "[dir]/[name]",
outdir: buildFolder,
loader: {
Expand Down
41 changes: 0 additions & 41 deletions packages/ag-grid-theme/src/dependencies/ThemeSwitcher.tsx

This file was deleted.

28 changes: 9 additions & 19 deletions packages/ag-grid-theme/src/dependencies/useAgGridHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@ import { LicenseManager } from "ag-grid-enterprise";
LicenseManager.setLicenseKey("your license key");

interface AgGridHelpersProps {
agThemeName: string;
compact?: boolean;
mode?: string;
density?: string;
}

// Helps to set className, rowHeight and headerHeight depending on the current density
export function useAgGridHelpers({
agThemeName = "ag-theme-uitk",
compact = false,
mode: modeProp,
density: densityProp,
}: AgGridHelpersProps): {
}: AgGridHelpersProps = {}): {
containerProps: HTMLAttributes<HTMLDivElement>;
agGridProps: AgGridReactProps;
isGridReady: boolean;
Expand All @@ -43,31 +41,23 @@ export function useAgGridHelpers({
const density = densityProp ?? contextDensity;

const [rowHeight, listItemHeight] = useMemo(() => {
switch ([agThemeName, density].join("-")) {
case "ag-theme-uitk-high":
return [20, 24];
case "ag-theme-uitk-medium":
return [24, 36];
case "ag-theme-uitk-low":
return [32, 48];
case "ag-theme-uitk-touch":
return [32, 60];
case compact && "ag-theme-salt-high":
switch (density) {
case compact && "high":
return [20, 20];
case "ag-theme-salt-high":
case "high":
return [24, 24];
case "ag-theme-salt-medium":
case "medium":
return [36, 36];
case "ag-theme-salt-low":
case "low":
return [48, 48];
case "ag-theme-salt-touch":
case "touch":
return [60, 60];
default:
return [20, 24];
}
}, [density, agThemeName, compact]);
}, [density, compact]);

const className = `${agThemeName}${
const className = `ag-theme-salt-${
compact && density === "high" ? `-compact` : ``
}-${mode}`;

Expand Down
34 changes: 13 additions & 21 deletions packages/ag-grid-theme/src/examples/CheckboxSelection.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
import { AgGridReact } from "ag-grid-react";
import { StackLayout } from "@salt-ds/core";
import dataGridExampleData from "../dependencies/dataGridExampleData";
import { AgGridReact, AgGridReactProps } from "ag-grid-react";
import dataGridExampleColumns from "../dependencies/dataGridExampleColumns";
import dataGridExampleData from "../dependencies/dataGridExampleData";
import { useAgGridHelpers } from "../dependencies/useAgGridHelpers";
import { useAgGridThemeSwitcher } from "../dependencies/ThemeSwitcher";

const CheckboxSelection = (props: { defaultTheme: string }) => {
const { defaultTheme = "salt" } = props;
const { themeName, switcher } = useAgGridThemeSwitcher(defaultTheme);
const { agGridProps, containerProps } = useAgGridHelpers({
agThemeName: `ag-theme-${themeName}`,
});
const CheckboxSelection = (props: AgGridReactProps) => {
const { agGridProps, containerProps } = useAgGridHelpers();

return (
<StackLayout gap={4}>
{switcher}
<div {...containerProps}>
<AgGridReact
{...agGridProps}
rowData={dataGridExampleData}
columnDefs={dataGridExampleColumns}
rowSelection="multiple"
/>
</div>
</StackLayout>
<div {...containerProps}>
<AgGridReact
{...agGridProps}
{...props}
rowData={dataGridExampleData}
columnDefs={dataGridExampleColumns}
rowSelection="multiple"
/>
</div>
);
};

Expand Down
Loading

0 comments on commit 47dec79

Please sign in to comment.