Skip to content

Commit

Permalink
Merge pull request #7174 from Sage/FE-7054_time-colon-out-of-position
Browse files Browse the repository at this point in the history
fix(form): ensure that additional margin-bottom is not applied to Time component - FE-7054
  • Loading branch information
DipperTheDan authored Jan 24, 2025
2 parents 82596c2 + 47151b2 commit e073502
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion src/components/form/form-test.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-console */
import React, { useState } from "react";

import { StoryObj } from "@storybook/react/*";
import TextEditor, { EditorState } from "../text-editor";
import Form from ".";
import Button from "../button";
Expand All @@ -25,6 +26,7 @@ import InlineInputs from "../inline-inputs";
import Pager from "../pager";
import Password from "../password";
import Search, { SearchProps } from "../search";
import { Time } from "../time";

export default {
title: "Form/Test",
Expand All @@ -37,7 +39,9 @@ export default {
},
};

export const DefaultWithStickyFooter = ({ ...props }) => (
type StoryType = StoryObj<typeof Form>;

export const DefaultWithStickyFooter: StoryType = ({ ...props }) => (
<Form
onSubmit={() => console.log("submit")}
leftSideButtons={
Expand All @@ -63,6 +67,14 @@ export const DefaultWithStickyFooter = ({ ...props }) => (
</Tabs>
<Textbox label="Textbox" />
<Textbox label="Textbox" />
<Time
value={{
hours: "",
minutes: "",
}}
onChange={() => {}}
label="Time"
/>
<Textbox label="Textbox" />
<Textbox label="Textbox" />
<Textbox label="Textbox" />
Expand All @@ -78,6 +90,21 @@ DefaultWithStickyFooter.args = {
warningCount: 0,
buttonAlignment: "right",
};
DefaultWithStickyFooter.parameters = {
themeProvider: {
chromatic: { theme: "sage" },
},
chromatic: {
disableSnapshot: false,
},
};
DefaultWithStickyFooter.decorators = [
(Story) => (
<div style={{ height: "100vh", width: "97vw" }}>
<Story />
</div>
),
];

export const FormAlignmentCustomMarginsTextInputs = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/form.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const StyledForm = styled.form<StyledFormProps>`
`}
// field spacing is also applied to form field here so we need to override
${StyledSearch} ${StyledFormField}, ${StyledTextarea} ${StyledFormField} {
${StyledSearch} ${StyledFormField}, ${StyledTextarea} ${StyledFormField}, [data-component="time"] ${StyledFormField} {
margin-bottom: var(--spacing000);
}
Expand Down

0 comments on commit e073502

Please sign in to comment.