Skip to content

Commit

Permalink
Fix form & tabs UI issues (#26)
Browse files Browse the repository at this point in the history
* fix(form): remove form wrapper

* fix(tabs): overflow issue
  • Loading branch information
abhishekv24 authored Feb 2, 2024
1 parent 189d601 commit 02fece4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 11 additions & 13 deletions packages/apsara-ui/src/FormBuilder/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as React from "react";
import { useMemo } from "react";
import classNames from "classnames";
import FieldForm, { List } from "rc-field-form";
import { List } from "rc-field-form";
import { FormProps as RcFormProps } from "rc-field-form/lib/Form";
import { ValidateErrorEntity } from "rc-field-form/lib/interface";
import { ColProps } from "./grid/col";
import { FormContext, FormContextProps } from "./context";
import { FormLabelAlign } from "./interface";
import useForm, { FormInstance } from "./hooks/useForm";
import SizeContext, { SizeType, SizeContextProvider } from "./SizeContext";
import { FormWrapper } from "./FormBuilder.styles";
import { StyledFieldForm } from "./FormBuilder.styles";

export type RequiredMark = boolean | "optional";
export type FormLayout = "horizontal" | "inline" | "vertical";
Expand Down Expand Up @@ -95,17 +95,15 @@ const InternalForm: React.ForwardRefRenderFunction<FormInstance, FormProps> = (p
return (
<SizeContextProvider size={size}>
<FormContext.Provider value={formContextValue}>
<FormWrapper>
<FieldForm
id={name}
{...restFormProps}
name={name}
onFinishFailed={onInternalFinishFailed}
form={wrapForm}
className={formClassName}
validateMessages={validateMessages}
/>
</FormWrapper>
<StyledFieldForm
id={name}
{...restFormProps}
name={name}
onFinishFailed={onInternalFinishFailed}
form={wrapForm}
className={formClassName}
validateMessages={validateMessages}
/>
</FormContext.Provider>
</SizeContextProvider>
);
Expand Down
23 changes: 12 additions & 11 deletions packages/apsara-ui/src/FormBuilder/FormBuilder.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled, { keyframes } from "styled-components";
import FieldForm from "rc-field-form";

const explainShowHelpIn = keyframes`
0% {
Expand All @@ -17,8 +18,8 @@ to {
}
`;

export const FormWrapper = styled.div`
.custom-form-inline {
export const StyledFieldForm: typeof FieldForm = styled(FieldForm)`
&.custom-form-inline {
display: flex;
flex-wrap: wrap;
.custom-form-item {
Expand Down Expand Up @@ -46,7 +47,7 @@ export const FormWrapper = styled.div`
margin-bottom: 24px;
}
}
.custom-form-horizontal {
&.custom-form-horizontal {
.custom-form-item-label {
flex-grow: 0;
}
Expand All @@ -71,7 +72,7 @@ export const FormWrapper = styled.div`
}
}
}
.custom-form-vertical {
&.custom-form-vertical {
.custom-form-item {
flex-direction: column;
.custom-form-item-control {
Expand All @@ -93,7 +94,7 @@ export const FormWrapper = styled.div`
text-align: left;
}
}
.custom-form-rtl.custom-form-vertical {
&.custom-form-rtl.custom-form-vertical {
.custom-form-item-label {
text-align: right;
}
Expand All @@ -114,7 +115,7 @@ export const FormWrapper = styled.div`
color: #ff4d4f;
}
}
.custom-form {
&.custom-form {
box-sizing: border-box;
margin: 0;
padding: 0;
Expand Down Expand Up @@ -187,7 +188,7 @@ export const FormWrapper = styled.div`
padding-right: 8px;
}
}
.custom-form-small {
&.custom-form-small {
.custom-form-item-label {
>label {
height: 24px;
Expand All @@ -197,7 +198,7 @@ export const FormWrapper = styled.div`
min-height: 24px;
}
}
.custom-form-large {
&.custom-form-large {
.custom-form-item-label {
>label {
height: 32px;
Expand Down Expand Up @@ -295,7 +296,7 @@ export const FormWrapper = styled.div`
line-height: 1.3215em;
white-space: unset;
}
.custom-form-hide-required-mark {
&.custom-form-hide-required-mark {
.custom-form-item-label {
>label.custom-form-item-required {
&:not(.custom-form-item-required-mark-optional) {
Expand Down Expand Up @@ -409,7 +410,7 @@ export const FormWrapper = styled.div`
overflow: hidden;
transition: height 0.2s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) !important;
}
.custom-form-rtl {
&.custom-form-rtl {
direction: rtl;
.custom-form-item-label {
text-align: left;
Expand Down Expand Up @@ -454,7 +455,7 @@ export const FormWrapper = styled.div`
}
}
}
.custom-form-rtl.custom-form-inline {
&.custom-form-rtl.custom-form-inline {
.custom-form-item {
margin-right: 0;
margin-left: 16px;
Expand Down
3 changes: 2 additions & 1 deletion packages/apsara-ui/src/Tabs/Tabs.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const StyledTabs = styled(TabsPrimitive.Root)`
height: 100%;
overflow-y: auto;
[role="tabpanel"] {
height: 100%
overflow-y: auto;
height: 100%;
}
`;

Expand Down

0 comments on commit 02fece4

Please sign in to comment.