diff --git a/src/Stepper/style/Stepper.module.scss b/src/Stepper/style/Stepper.module.scss index dbd9519..be97659 100644 --- a/src/Stepper/style/Stepper.module.scss +++ b/src/Stepper/style/Stepper.module.scss @@ -44,8 +44,8 @@ &:not(:first-of-type) { &:before { content: ""; - height: 2px; - width: min(140px, 10vw); + height: 1px; + width: min(140px, 4vw); background-color: var(--color-border); border-radius: 2px; margin-right: var(--m-xs); diff --git a/src/Stepper/types/Stepper.stories.tsx b/src/Stepper/types/Stepper.stories.tsx new file mode 100644 index 0000000..7590f42 --- /dev/null +++ b/src/Stepper/types/Stepper.stories.tsx @@ -0,0 +1,29 @@ +import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { StepperProps } from "."; +import Stepper from ".."; + +const steps = [ + { label: "Upload", id: "upload" }, + { label: "Select Header Row", id: "row-selection" }, + { label: "Review", id: "review" }, + { label: "Complete", id: "complete" }, +]; + +export default { + title: "User Interface/Stepper", + component: Stepper, + argTypes: {}, +} as ComponentMeta; + +const Template: ComponentStory = (args: StepperProps) => { + return ( +
+ +
+ ); +}; + +export const Default = Template.bind({}); +Default.args = { + steps, +}; diff --git a/src/Table/Table.stories.tsx b/src/Table/Table.stories.tsx index fcf3493..396234c 100644 --- a/src/Table/Table.stories.tsx +++ b/src/Table/Table.stories.tsx @@ -24,3 +24,4 @@ Table.args = { hideColumns: ["id"], fixHeader: true, }; +Table.args.onRowClick = (row: any) => console.log("Row clicked", row); diff --git a/src/Table/index.tsx b/src/Table/index.tsx index 87491db..cabf08a 100644 --- a/src/Table/index.tsx +++ b/src/Table/index.tsx @@ -18,6 +18,7 @@ export default function Table({ columnWidths = [], columnAlignments = [], fixHeader = false, + onRowClick, }: TableProps): React.ReactElement { // THEME // Tables receive a full CSS module as theme or applies default styles @@ -60,7 +61,7 @@ export default function Table({
{data.map((d, i) => { const key = keyAsId && d?.[keyAsId] ? d[keyAsId] : i; - const props = { datum: d }; + const props = { datum: d, onClick: onRowClick }; return ; })}
@@ -74,13 +75,13 @@ export default function Table({ ); } -const Row = ({ datum }: RowProps) => { +const Row = ({ datum, onClick }: RowProps) => { const { style, highlightColumns, hideColumns, columnWidths, columnAlignments } = useContext(TableContext); const className = classes([style?.tr]); return ( -
+
onClick?.(datum)}> {Object.keys(datum) .filter((k) => !hideColumns.includes(datum[k]) && !hideColumns.includes(k)) .map((k, i) => { diff --git a/src/Table/types/index.ts b/src/Table/types/index.ts index 76d83a1..0a177cd 100644 --- a/src/Table/types/index.ts +++ b/src/Table/types/index.ts @@ -31,11 +31,13 @@ export type TableProps = { columnWidths?: string[]; columnAlignments?: ("left" | "center" | "right" | "")[]; fixHeader?: boolean; + onRowClick?: (row: TableDatum) => void; }; export type RowProps = { datum: TableDatum; isHeading?: boolean; + onClick?: (row: TableDatum) => void; }; export type CellProps = PropsWithChildren<{