* feat: New Object - Add Object type section #1918 * fix: dark mode border color * feat: New Object - Add Object type section #1918 * fix: dark mode border color * Requested changes in the PR * fix(new object): requested changes in the PR * fix(1985): border color
This commit is contained in:
@ -0,0 +1,67 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { useTheme } from '@emotion/react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { IconBox, IconDatabase, IconFileCheck } from '@/ui/display/icon';
|
||||||
|
|
||||||
|
import { ObjectTypeCard } from './ObjectTypeCard';
|
||||||
|
|
||||||
|
const StyledContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: ${({ theme }) => theme.spacing(5)};
|
||||||
|
margin-bottom: ${({ theme }) => theme.spacing(8)};
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const NewObjectType = () => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const [selectedType, setSelectedType] = useState<string | null>(null);
|
||||||
|
const handleCardClick = (selectedType: string) => {
|
||||||
|
setSelectedType(selectedType);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<StyledContainer>
|
||||||
|
<ObjectTypeCard
|
||||||
|
title="Standard"
|
||||||
|
color="blue"
|
||||||
|
selected={selectedType === 'Standard'}
|
||||||
|
prefixIcon={
|
||||||
|
<IconFileCheck
|
||||||
|
size={theme.icon.size.lg}
|
||||||
|
stroke={theme.icon.stroke.sm}
|
||||||
|
color={theme.font.color.tertiary}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onClick={() => handleCardClick('Standard')}
|
||||||
|
></ObjectTypeCard>
|
||||||
|
<ObjectTypeCard
|
||||||
|
title="Custom"
|
||||||
|
color="orange"
|
||||||
|
selected={selectedType === 'Custom'}
|
||||||
|
prefixIcon={
|
||||||
|
<IconBox
|
||||||
|
size={theme.icon.size.lg}
|
||||||
|
stroke={theme.icon.stroke.sm}
|
||||||
|
color={theme.font.color.tertiary}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onClick={() => handleCardClick('Custom')}
|
||||||
|
></ObjectTypeCard>
|
||||||
|
<ObjectTypeCard
|
||||||
|
title="Remote"
|
||||||
|
soon
|
||||||
|
disabled
|
||||||
|
color="green"
|
||||||
|
selected={selectedType === 'Remote'}
|
||||||
|
prefixIcon={
|
||||||
|
<IconDatabase
|
||||||
|
size={theme.icon.size.lg}
|
||||||
|
stroke={theme.icon.stroke.sm}
|
||||||
|
color={theme.font.color.tertiary}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
></ObjectTypeCard>
|
||||||
|
</StyledContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
import { useTheme } from '@emotion/react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { IconCheck } from '@/ui/display/icon';
|
||||||
|
import { SoonPill } from '@/ui/display/pill/components/SoonPill';
|
||||||
|
import { Tag } from '@/ui/display/tag/components/Tag';
|
||||||
|
import { ThemeColor } from '@/ui/theme/constants/colors';
|
||||||
|
|
||||||
|
const StyledObjectTypeCard = styled.div<ObjectTypeCardProps>`
|
||||||
|
${({ theme, disabled, selected }) => `
|
||||||
|
background: ${theme.background.transparent.primary};
|
||||||
|
cursor: ${disabled ? 'not-allowed' : 'pointer'};
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
font-family: ${theme.font.family};
|
||||||
|
font-weight: 500;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: '1px';
|
||||||
|
padding: ${theme.spacing(3)};
|
||||||
|
border-radius: ${theme.border.radius.sm};
|
||||||
|
gap: ${theme.spacing(2)};
|
||||||
|
border-color: ${
|
||||||
|
selected ? theme.border.color.inverted : theme.border.color.medium
|
||||||
|
};
|
||||||
|
color: ${theme.font.color.primary};
|
||||||
|
align-items: center;
|
||||||
|
width: 140px;
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledTag = styled(Tag)`
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: ${({ theme }) => theme.spacing(5)};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledIconCheck = styled(IconCheck)`
|
||||||
|
margin-left: auto;
|
||||||
|
`;
|
||||||
|
|
||||||
|
type ObjectTypeCardProps = {
|
||||||
|
prefixIcon?: React.ReactNode;
|
||||||
|
title: string;
|
||||||
|
soon?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
color: ThemeColor;
|
||||||
|
selected: boolean;
|
||||||
|
onClick?: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ObjectTypeCard = ({
|
||||||
|
prefixIcon,
|
||||||
|
title,
|
||||||
|
soon = false,
|
||||||
|
selected,
|
||||||
|
disabled = false,
|
||||||
|
color,
|
||||||
|
onClick,
|
||||||
|
}: ObjectTypeCardProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
return (
|
||||||
|
<div onClick={() => onclick}>
|
||||||
|
<StyledObjectTypeCard
|
||||||
|
title={title}
|
||||||
|
soon={soon}
|
||||||
|
disabled={disabled}
|
||||||
|
color={color}
|
||||||
|
selected={selected}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{prefixIcon}
|
||||||
|
<StyledTag color={color} text={title} />
|
||||||
|
{soon && <SoonPill />}
|
||||||
|
{!disabled && selected && <StyledIconCheck size={theme.icon.size.md} />}
|
||||||
|
</StyledObjectTypeCard>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export {};
|
||||||
@ -11,6 +11,7 @@ export {
|
|||||||
IconArrowUp,
|
IconArrowUp,
|
||||||
IconArrowUpRight,
|
IconArrowUpRight,
|
||||||
IconBell,
|
IconBell,
|
||||||
|
IconBox,
|
||||||
IconBrandGithub,
|
IconBrandGithub,
|
||||||
IconBrandGoogle,
|
IconBrandGoogle,
|
||||||
IconBrandLinkedin,
|
IconBrandLinkedin,
|
||||||
@ -34,9 +35,11 @@ export {
|
|||||||
IconCopy,
|
IconCopy,
|
||||||
IconCross,
|
IconCross,
|
||||||
IconCurrencyDollar,
|
IconCurrencyDollar,
|
||||||
|
IconDatabase,
|
||||||
IconDotsVertical,
|
IconDotsVertical,
|
||||||
IconEye,
|
IconEye,
|
||||||
IconEyeOff,
|
IconEyeOff,
|
||||||
|
IconFileCheck,
|
||||||
IconFileImport,
|
IconFileImport,
|
||||||
IconFileUpload,
|
IconFileUpload,
|
||||||
IconForbid,
|
IconForbid,
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { SettingsIconSection } from '@/settings/components/SettingsIconSection';
|
import { NewObjectType } from '@/settings/objects/components/NewObjectType';
|
||||||
import { objectSettingsWidth } from '@/settings/objects/constants/objectSettings';
|
import { objectSettingsWidth } from '@/settings/objects/constants/objectSettings';
|
||||||
import { IconSettings } from '@/ui/input/constants/icons';
|
import { IconSettings } from '@/ui/display/icon';
|
||||||
import { useIconPicker } from '@/ui/input/hooks/useIconPicker';
|
import { H2Title } from '@/ui/display/typography/components/H2Title';
|
||||||
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
|
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
|
||||||
|
import { Section } from '@/ui/layout/section/components/Section';
|
||||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
@ -18,8 +19,6 @@ const StyledContainer = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const SettingsNewObject = () => {
|
export const SettingsNewObject = () => {
|
||||||
const { Icon, iconKey, setIconPicker } = useIconPicker();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SubMenuTopBarContainer Icon={IconSettings} title="Settings">
|
<SubMenuTopBarContainer Icon={IconSettings} title="Settings">
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
@ -29,12 +28,13 @@ export const SettingsNewObject = () => {
|
|||||||
{ children: 'New' },
|
{ children: 'New' },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
<Section>
|
||||||
<SettingsIconSection
|
<H2Title
|
||||||
Icon={Icon}
|
title="Object Type"
|
||||||
iconKey={iconKey}
|
description="The type of object you want to add"
|
||||||
setIconPicker={setIconPicker}
|
/>
|
||||||
/>
|
</Section>
|
||||||
|
<NewObjectType></NewObjectType>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
</SubMenuTopBarContainer>
|
</SubMenuTopBarContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user