Skip to content

Commit

Permalink
added FormHeader component
Browse files Browse the repository at this point in the history
  • Loading branch information
skorphil committed Feb 9, 2024
1 parent 0fcdd63 commit f9e9bf6
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
25 changes: 25 additions & 0 deletions components/FormHeader/FormHeader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Button, ButtonGroup, Heading, HStack } from "@chakra-ui/react";

export function FormHeader({ rightButtons, text }) {
return (
<HStack gap={4} p={2} justifyContent="space-between">
<Heading
textOverflow="ellipsis"
overflow="hidden"
whiteSpace="nowrap"
size="lg"
>
{text}
</Heading>

<ButtonGroup>{rightButtons}</ButtonGroup>
</HStack>
);
}

// const rightButton = (
// <>
// <Button variant="outline">Cancel</Button>
// <Button>Save</Button>
// </>
// );
Empty file.
35 changes: 35 additions & 0 deletions components/FormHeader/FormHeader.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { FormHeader } from "./FormHeader";
import { Button, IconButton } from "@chakra-ui/react";
import { CgMinimizeAlt } from "react-icons/cg";

const meta = {
title: "RecordForm/FormHeader",
component: FormHeader,
argTypes: {
rightButtons: {
options: ["saveCancel", "minimize"],
control: { type: "radio" },
mapping: {
saveCancel: (
<>
<Button variant="outline">Cancel</Button>
<Button>Save</Button>
</>
),
minimize: (
<IconButton
aria-label="minimize"
icon={<CgMinimizeAlt size="24px" />}
/>
),
},
},
},
};
export default meta;

export const Default = {
args: {
text: "New Record",
},
};
1 change: 1 addition & 0 deletions components/FormHeader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FormHeader } from "./FormHeader";
7 changes: 3 additions & 4 deletions components/InstitutionTab/InstitutionTab.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

.stateIcon {
flex-shrink: 0;
width: var(--chakra-sizes-7);
width: var(--chakra-sizes-8);
padding: 2px;

font-weight: var(--chakra-fontWeights-extrabold);
Expand All @@ -32,9 +32,6 @@
padding-left: var(--chakra-sizes-1);
gap: var(--chakra-sizes-3);

text-overflow:ellipsis;
white-space:nowrap;

border-radius: var(--chakra-radii-lg);
}

Expand All @@ -43,4 +40,6 @@
max-width: 100%;
min-width: var(--chakra-sizes-1);
overflow: hidden;
text-overflow:clip;
white-space:nowrap;
}

0 comments on commit f9e9bf6

Please sign in to comment.