Skip to content

Commit

Permalink
feat: add example dirs across remaning react examples
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgallo committed Nov 15, 2024
1 parent 6cfeeff commit 33bd76b
Show file tree
Hide file tree
Showing 89 changed files with 147 additions and 498 deletions.
11 changes: 11 additions & 0 deletions react/pagination/src/Example/Example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Grid, Column } from '@carbon/react';
import { PaginationExample } from './Pagination';
import './example.scss';

export const Example = () => (
<Grid className="page-grid">
<Column sm={4} md={8} lg={16}>
<PaginationExample />
</Column>
</Grid>
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import {
getPaginationRowModel,
} from '@tanstack/react-table';
import { makeData } from './makeData';
import { ExampleLink } from './ExampleLink';
import { Launch } from '@carbon/react/icons';
import * as packageJson from '../package.json';

type Resource = {
id: string;
Expand Down Expand Up @@ -88,24 +85,6 @@ export const PaginationExample = () => {
<TableContainer
title="Pagination"
className="basic-table tanstack-example"
description={
<span className="flex">
<ExampleLink
url={`${import.meta.env.VITE_CODE_SANDBOX_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="Code sandbox"
/>
<ExampleLink
url={`${import.meta.env.VITE_STACK_BLITZ_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="StackBlitz"
/>
</span>
}
style={{
width: table.getCenterTotalSize(),
}}>
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions react/pagination/src/Example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Example } from './Example';
File renamed without changes.
9 changes: 0 additions & 9 deletions react/pagination/src/ExampleLink.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions react/pagination/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,8 @@
);
@use '@carbon/styles/scss/type';
@use '@carbon/ibm-products/css/index';
@use './App';

body {
margin: 0;
padding: 0;
}

.example--link {
@include type.type-style('label-01');

display: flex;
align-items: center;
margin-right: 0.5rem;
}

.example--link__icon {
margin-right: 0.25rem;
}
3 changes: 0 additions & 3 deletions react/pagination/src/index.ts

This file was deleted.

11 changes: 2 additions & 9 deletions react/pagination/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import {
CodeSnippet,
Column,
Grid,
Header,
HeaderContainer,
HeaderName,
} from '@carbon/react';

import { PaginationExample } from './Pagination';
import { Example } from './Example';

import './index.scss';

Expand All @@ -32,10 +29,6 @@ const renderUIShellHeader = () => (
createRoot(document.getElementById('root')!).render(
<StrictMode>
{renderUIShellHeader()}
<Grid className="page-grid">
<Column sm={4} md={8} lg={16}>
<PaginationExample />
</Column>
</Grid>
<Example />
</StrictMode>
);
2 changes: 1 addition & 1 deletion react/pagination/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

"types": [ "./src/customTypings.d.ts" ],
"types": ["./src/Example/customTypings.d.ts"],
"resolveJsonModule": true
},
"include": ["./src"]
Expand Down
11 changes: 11 additions & 0 deletions react/resizing/src/Example/Example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Grid, Column } from '@carbon/react';
import { ResizableCols } from './ResizableCols';
import './example.scss';

export const Example = () => (
<Grid className="page-grid">
<Column sm={4} md={8} lg={16}>
<ResizableCols />
</Column>
</Grid>
);
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import {
ColumnResizeMode,
} from '@tanstack/react-table';
import { makeData } from './makeData';
import { ExampleLink } from './ExampleLink';
import { Launch } from '@carbon/react/icons';
import * as packageJson from '../package.json';

type Resource = {
id: string;
Expand Down Expand Up @@ -80,24 +77,6 @@ export const ResizableCols = () => {
<TableContainer
title="Resizable columns"
className="basic-table tanstack-example"
description={
<span className="flex">
<ExampleLink
url={`${import.meta.env.VITE_CODE_SANDBOX_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="Code sandbox"
/>
<ExampleLink
url={`${import.meta.env.VITE_STACK_BLITZ_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="StackBlitz"
/>
</span>
}
style={{
width: table.getCenterTotalSize(),
}}>
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions react/resizing/src/Example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Example } from './Example';
File renamed without changes.
9 changes: 0 additions & 9 deletions react/resizing/src/ExampleLink.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions react/resizing/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,8 @@
);
@use '@carbon/styles/scss/type';
@use '@carbon/ibm-products/css/index';
@use './App';

body {
margin: 0;
padding: 0;
}

.example--link {
@include type.type-style('label-01');

display: flex;
align-items: center;
margin-right: 0.5rem;
}

.example--link__icon {
margin-right: 0.25rem;
}
3 changes: 0 additions & 3 deletions react/resizing/src/index.ts

This file was deleted.

11 changes: 2 additions & 9 deletions react/resizing/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import {
CodeSnippet,
Column,
Grid,
Header,
HeaderContainer,
HeaderName,
} from '@carbon/react';

import { ResizableCols } from './ResizableCols';

import './index.scss';
import { Example } from './Example';

const renderUIShellHeader = () => (
<HeaderContainer
Expand All @@ -32,10 +29,6 @@ const renderUIShellHeader = () => (
createRoot(document.getElementById('root')!).render(
<StrictMode>
{renderUIShellHeader()}
<Grid className="page-grid">
<Column sm={4} md={8} lg={16}>
<ResizableCols />
</Column>
</Grid>
<Example />
</StrictMode>
);
2 changes: 1 addition & 1 deletion react/resizing/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

"types": [ "./src/customTypings.d.ts" ],
"types": ["./src/Example/customTypings.d.ts"],
"resolveJsonModule": true
},
"include": ["./src"]
Expand Down
15 changes: 15 additions & 0 deletions react/row-actions/src/Example/Example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Grid, Column } from '@carbon/react';
import { RowActions } from './RowActions';
import { RowWithContextMenu } from './RowWithContextMenu';
import './example.scss';

export const Example = () => (
<Grid className="page-grid">
<Column sm={4} md={8} lg={16}>
<RowActions />
</Column>
<Column sm={4} md={8} lg={16}>
<RowWithContextMenu />
</Column>
</Grid>
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { CSSProperties } from 'react';
import React from 'react';

import {
Column,
flexRender,
getCoreRowModel,
useReactTable,
Expand All @@ -12,9 +11,6 @@ import { DataTable, IconButton, TableContainer } from '@carbon/react';
import { TrashCan, Edit } from '@carbon/react/icons';
const { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } =
DataTable;
import { ExampleLink } from './ExampleLink';
import { Launch } from '@carbon/react/icons';
import * as packageJson from '../package.json';

export const RowActions = () => {
const onDelete = (row: Resource) => {
Expand Down Expand Up @@ -91,25 +87,7 @@ export const RowActions = () => {
return (
<TableContainer
title="Row actions"
className="tanstack-example sticky-example"
description={
<span className="flex">
<ExampleLink
url={`${import.meta.env.VITE_CODE_SANDBOX_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="Code sandbox"
/>
<ExampleLink
url={`${import.meta.env.VITE_STACK_BLITZ_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="StackBlitz"
/>
</span>
}>
className="tanstack-example sticky-example">
<Table>
<TableHead>
{table.getHeaderGroups().map((headerGroup) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ import {
TableContainer,
useContextMenu,
} from '@carbon/react';
import { TrashCan } from '@carbon/react/icons';
const { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } =
DataTable;
import { ExampleLink } from './ExampleLink';
import { Launch, TrashCan } from '@carbon/react/icons';
import * as packageJson from '../package.json';

const ContextRow = ({ row, children, updateData, data }) => {
const el = useRef(null);
Expand Down Expand Up @@ -98,25 +96,7 @@ export const RowWithContextMenu = () => {
return (
<TableContainer
title="Row with context menu"
className="tanstack-example sticky-example"
description={
<span className="flex">
<ExampleLink
url={`${import.meta.env.VITE_CODE_SANDBOX_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="Code sandbox"
/>
<ExampleLink
url={`${import.meta.env.VITE_STACK_BLITZ_URL_ROOT}/${
packageJson.name
}`}
icon={Launch}
label="StackBlitz"
/>
</span>
}>
className="tanstack-example sticky-example">
<Table>
<TableHead>
{table.getHeaderGroups().map((headerGroup) => (
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions react/row-actions/src/Example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Example } from './Example';
File renamed without changes.
9 changes: 0 additions & 9 deletions react/row-actions/src/ExampleLink.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions react/row-actions/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,8 @@
);
@use '@carbon/styles/scss/type';
@use '@carbon/ibm-products/css/index';
@use './App';

body {
margin: 0;
padding: 0;
}

.example--link {
@include type.type-style('label-01');

display: flex;
align-items: center;
margin-right: 0.5rem;
}

.example--link__icon {
margin-right: 0.25rem;
}
3 changes: 0 additions & 3 deletions react/row-actions/src/index.ts

This file was deleted.

Loading

0 comments on commit 33bd76b

Please sign in to comment.