Chores #6389 ## Description This PR addresses inconsistencies in the codebase where elements that visually function as labels were implemented with custom-styled components rather than the standardized Label component from the UI library. ## Changes I've replaced several custom-styled text elements with the standardized Label component from twenty-ui to improve consistency and maintainability across the application. These modifications maintain the same visual appearance and functionality while standardizing the implementation. ## Components Modified: InputLabel: Converted from a styled label to use the Label component InputHint: Replaced styled div with a styled Label component TableSection: Introduced a StyledLabel using the Label component for section headings StyledDropdownMenuSubheader: Converted from a styled div to a styled Label component NavigationDrawerSectionTitle: Replaced internal text element with the Label component SettingsCard: Updated description element to use the Label component SettingsListItemCardContent: Changed description span to use the Label component RecordDetailSectionHeader: Added a StyledLabelLink for link text using the Label component TaskList: Modified the task count display to use the Label component CommandGroup: Updated group headings to use the Label component WorkerMetricsGraph: Replaced no-data message with a Label-based component ViewPickerSelectContainer: Changed from a styled div to a styled Label component --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -1,11 +1,9 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Label } from 'twenty-ui';
|
||||||
|
|
||||||
const StyledGroupHeading = styled.div`
|
const StyledGroupHeading = styled(Label)`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
|
||||||
font-size: ${({ theme }) => theme.font.size.xs};
|
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
|
||||||
padding-bottom: ${({ theme }) => theme.spacing(1)};
|
padding-bottom: ${({ theme }) => theme.spacing(1)};
|
||||||
padding-left: ${({ theme }) => theme.spacing(2)};
|
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(1)};
|
padding-right: ${({ theme }) => theme.spacing(1)};
|
||||||
|
|||||||
@ -210,7 +210,7 @@ export const AddressInput = ({
|
|||||||
autoFocus
|
autoFocus
|
||||||
value={internalValue.addressStreet1 ?? ''}
|
value={internalValue.addressStreet1 ?? ''}
|
||||||
ref={inputRefs['addressStreet1']}
|
ref={inputRefs['addressStreet1']}
|
||||||
label="ADDRESS 1"
|
label="Address 1"
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={getChangeHandler('addressStreet1')}
|
onChange={getChangeHandler('addressStreet1')}
|
||||||
onFocus={getFocusHandler('addressStreet1')}
|
onFocus={getFocusHandler('addressStreet1')}
|
||||||
@ -218,7 +218,7 @@ export const AddressInput = ({
|
|||||||
<TextInputV2
|
<TextInputV2
|
||||||
value={internalValue.addressStreet2 ?? ''}
|
value={internalValue.addressStreet2 ?? ''}
|
||||||
ref={inputRefs['addressStreet2']}
|
ref={inputRefs['addressStreet2']}
|
||||||
label="ADDRESS 2"
|
label="Address 2"
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={getChangeHandler('addressStreet2')}
|
onChange={getChangeHandler('addressStreet2')}
|
||||||
onFocus={getFocusHandler('addressStreet2')}
|
onFocus={getFocusHandler('addressStreet2')}
|
||||||
@ -227,7 +227,7 @@ export const AddressInput = ({
|
|||||||
<TextInputV2
|
<TextInputV2
|
||||||
value={internalValue.addressCity ?? ''}
|
value={internalValue.addressCity ?? ''}
|
||||||
ref={inputRefs['addressCity']}
|
ref={inputRefs['addressCity']}
|
||||||
label="CITY"
|
label="City"
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={getChangeHandler('addressCity')}
|
onChange={getChangeHandler('addressCity')}
|
||||||
onFocus={getFocusHandler('addressCity')}
|
onFocus={getFocusHandler('addressCity')}
|
||||||
@ -235,7 +235,7 @@ export const AddressInput = ({
|
|||||||
<TextInputV2
|
<TextInputV2
|
||||||
value={internalValue.addressState ?? ''}
|
value={internalValue.addressState ?? ''}
|
||||||
ref={inputRefs['addressState']}
|
ref={inputRefs['addressState']}
|
||||||
label="STATE"
|
label="State"
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={getChangeHandler('addressState')}
|
onChange={getChangeHandler('addressState')}
|
||||||
onFocus={getFocusHandler('addressState')}
|
onFocus={getFocusHandler('addressState')}
|
||||||
@ -245,13 +245,13 @@ export const AddressInput = ({
|
|||||||
<TextInputV2
|
<TextInputV2
|
||||||
value={internalValue.addressPostcode ?? ''}
|
value={internalValue.addressPostcode ?? ''}
|
||||||
ref={inputRefs['addressPostcode']}
|
ref={inputRefs['addressPostcode']}
|
||||||
label="POST CODE"
|
label="Post Code"
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={getChangeHandler('addressPostcode')}
|
onChange={getChangeHandler('addressPostcode')}
|
||||||
onFocus={getFocusHandler('addressPostcode')}
|
onFocus={getFocusHandler('addressPostcode')}
|
||||||
/>
|
/>
|
||||||
<CountrySelect
|
<CountrySelect
|
||||||
label="COUNTRY"
|
label="Country"
|
||||||
onChange={getChangeHandler('addressCountry')}
|
onChange={getChangeHandler('addressCountry')}
|
||||||
selectedCountryName={internalValue.addressCountry ?? ''}
|
selectedCountryName={internalValue.addressCountry ?? ''}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { HTMLAttributes } from 'react';
|
||||||
|
import { Label } from 'twenty-ui';
|
||||||
|
|
||||||
const StyledLabel = styled.label`
|
type InputLabelProps = HTMLAttributes<HTMLLabelElement> & {
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
htmlFor?: string;
|
||||||
font-size: ${({ theme }) => theme.font.size.xs};
|
};
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
|
||||||
|
const StyledInputLabel = styled(Label)<InputLabelProps>`
|
||||||
|
display: block;
|
||||||
margin-bottom: ${({ theme }) => theme.spacing(1)};
|
margin-bottom: ${({ theme }) => theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const InputLabel = StyledLabel;
|
export const InputLabel = StyledInputLabel;
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { Label } from 'twenty-ui';
|
||||||
|
|
||||||
export const StyledDropdownMenuSubheader = styled.div`
|
export const StyledDropdownMenuSubheader = styled(Label)`
|
||||||
background-color: ${({ theme }) => theme.background.transparent.lighter};
|
background-color: ${({ theme }) => theme.background.transparent.lighter};
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
|
||||||
font-size: ${({ theme }) => theme.font.size.xxs};
|
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
|
||||||
padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`};
|
padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`};
|
||||||
text-transform: uppercase;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { ReactNode, useState } from 'react';
|
import { ReactNode, useState } from 'react';
|
||||||
import { IconChevronDown, IconChevronUp } from 'twenty-ui';
|
import { IconChevronDown, IconChevronUp, Label } from 'twenty-ui';
|
||||||
import { TableBody } from './TableBody';
|
import { TableBody } from './TableBody';
|
||||||
|
|
||||||
type TableSectionProps = {
|
type TableSectionProps = {
|
||||||
@ -14,16 +14,12 @@ const StyledSectionHeader = styled.div<{ isExpanded: boolean }>`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: ${({ theme }) => theme.background.transparent.lighter};
|
background-color: ${({ theme }) => theme.background.transparent.lighter};
|
||||||
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
|
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: ${({ theme }) => theme.font.size.xs};
|
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
|
||||||
height: ${({ theme }) => theme.spacing(6)};
|
height: ${({ theme }) => theme.spacing(6)};
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 ${({ theme }) => theme.spacing(2)};
|
padding: 0 ${({ theme }) => theme.spacing(2)};
|
||||||
text-align: left;
|
text-align: left;
|
||||||
text-transform: uppercase;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledSection = styled.div<{ isExpanded: boolean }>`
|
const StyledSection = styled.div<{ isExpanded: boolean }>`
|
||||||
@ -44,8 +40,8 @@ export const TableSection = ({
|
|||||||
isInitiallyExpanded = true,
|
isInitiallyExpanded = true,
|
||||||
title,
|
title,
|
||||||
}: TableSectionProps) => {
|
}: TableSectionProps) => {
|
||||||
const theme = useTheme();
|
|
||||||
const [isExpanded, setIsExpanded] = useState(isInitiallyExpanded);
|
const [isExpanded, setIsExpanded] = useState(isInitiallyExpanded);
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const handleToggleSection = () =>
|
const handleToggleSection = () =>
|
||||||
setIsExpanded((previousIsExpanded) => !previousIsExpanded);
|
setIsExpanded((previousIsExpanded) => !previousIsExpanded);
|
||||||
@ -56,11 +52,17 @@ export const TableSection = ({
|
|||||||
isExpanded={isExpanded}
|
isExpanded={isExpanded}
|
||||||
onClick={handleToggleSection}
|
onClick={handleToggleSection}
|
||||||
>
|
>
|
||||||
{title}
|
<Label>{title}</Label>
|
||||||
{isExpanded ? (
|
{isExpanded ? (
|
||||||
<IconChevronUp size={theme.icon.size.sm} />
|
<IconChevronUp
|
||||||
|
size={theme.icon.size.md}
|
||||||
|
stroke={theme.icon.stroke.sm}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<IconChevronDown size={theme.icon.size.sm} />
|
<IconChevronDown
|
||||||
|
size={theme.icon.size.md}
|
||||||
|
stroke={theme.icon.stroke.sm}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</StyledSectionHeader>
|
</StyledSectionHeader>
|
||||||
<StyledSection isExpanded={isExpanded}>
|
<StyledSection isExpanded={isExpanded}>
|
||||||
|
|||||||
@ -8,14 +8,12 @@ import styled from '@emotion/styled';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared';
|
||||||
|
import { Label } from 'twenty-ui';
|
||||||
|
|
||||||
const StyledTitle = styled.div`
|
const StyledTitle = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: ${({ theme }) => theme.border.radius.sm};
|
border-radius: ${({ theme }) => theme.border.radius.sm};
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: ${({ theme }) => theme.font.size.xs};
|
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
|
||||||
height: ${({ theme }) => theme.spacing(5)};
|
height: ${({ theme }) => theme.spacing(5)};
|
||||||
padding-left: ${({ theme }) => theme.spacing(1)};
|
padding-left: ${({ theme }) => theme.spacing(1)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(0.5)};
|
padding-right: ${({ theme }) => theme.spacing(0.5)};
|
||||||
@ -29,7 +27,7 @@ const StyledTitle = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledLabel = styled.div`
|
const StyledLabelContainer = styled.div`
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -77,7 +75,9 @@ export const NavigationDrawerSectionTitle = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledTitle className="section-title-container">
|
<StyledTitle className="section-title-container">
|
||||||
<StyledLabel onClick={handleTitleClick}>{label}</StyledLabel>
|
<StyledLabelContainer onClick={handleTitleClick}>
|
||||||
|
<Label>{label}</Label>
|
||||||
|
</StyledLabelContainer>
|
||||||
{rightIcon && (
|
{rightIcon && (
|
||||||
<StyledRightIcon isMobile={isMobile}>{rightIcon}</StyledRightIcon>
|
<StyledRightIcon isMobile={isMobile}>{rightIcon}</StyledRightIcon>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user