-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v5 component refactor: Label #272
Comments
@HollyJoyPhillips I have created this issue for new element Label which dev ready over figma. |
Hello Genks, From the Figma design, the new Label design only requires adding new parameters, Here's my proposed solution: Updates to the Label Component1. UI Updates
2. New ParametersLabel Solution DesignThe Label will have the following main prop interface
Code Conceptto see the detail implementation, you can check it here (POC) please let me know if the link didnt work // types.ts
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
variant?: "soft" | "strong";
size?: "small" | "medium";
required?: boolean;
} // Label.tsx
export const Label: FC<LabelProps> = ({
children,
required,
size = "medium",
variant = "soft",
...rest
}) => {
return (
<ElLabel {...rest} data-size={size} data-variant={variant}>
{children}
{required && " *"}
</ElLabel>
);
}; //style.ts
export const ElLabel = styled.label`
&[data-size="small"] {
font-size: var(--font-size-xs);
}
&[data-size="medium"] {
font-size: var(--font-size-sm);
}
&[data-variant="soft"] {
color: var(--neutral-500);
}
&[data-variant="strong"] {
color: var(--text-primary);
}
`; |
praise: Thank you @rpt-rfoxy for coming up with the solution for your 1st ticket. suggestion: It is always a good idea to deprecate the old component and create a new one. Here's why:
note: In terms of UI updates, there are differences in the color, font, and other CSS properties in the new DS for the suggestion: I would personally recommend using suggestion: It would be great if the solution document includes what actual props will be used and their role in the component. Check this for ref: #242 suggestion: I believe using a data attribute provides a more component-centric and semantic approach compared to class names. For instance, if the React component prop is size, the corresponding styled component could utilize a |
praise: hi @ksolanki7 thanks for the feedback for the Design solution. |
@rpt-rfoxy praise Thanks for updating the solution. suggestion: From the POC - It is unnecessary to create a separate file for types when there are only a few interfaces and not shared. Including them directly within the component file is a more streamlined approach, enhancing readability and maintaining context. |
Abstract
As part of the v5 Elements release, each component will be reviewed and refactored to ensure best practice and design system alignment
Specification
Developer Checklist
Styles Only
andReact
component structuresRelease Checklist
The text was updated successfully, but these errors were encountered: