Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11841-changed-1741884096366.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Updated Breadcrumb component to conform to Akamai Design System specs ([#11841](https://github.com/linode/manager/pull/11841))
46 changes: 46 additions & 0 deletions packages/manager/src/components/Breadcrumb/Breadcrumb.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
import { action } from '@storybook/addon-actions';
import { Meta, StoryObj } from '@storybook/react';
import React from 'react';
import { Chip } from '@linode/ui';

import { Breadcrumb } from './Breadcrumb';

const withBadgeCrumbs = [
{
position: 3,
label: (
<>
<span>test</span>
<span
style={{
display: 'inline-block',
marginLeft: '4px',
textDecoration: 'none',
}}
>
<Chip label="beta" component="span" />
</span>
</>
),
},
];

const noBadgeCrumbs = [
{
position: 3,
label: <span>test</span>,
},
];

const meta: Meta<typeof Breadcrumb> = {
component: Breadcrumb,
title: 'Foundations/Breadcrumb',
argTypes: {
crumbOverrides: {
options: ['With Badge', 'No Badge'],
mapping: {
'With Badge': withBadgeCrumbs,
'No Badge': noBadgeCrumbs,
},
control: {
type: 'radio',
labels: {
'With Badge': 'Show Beta Badge',
'No Badge': 'Hide Beta Badge',
},
},
defaultValue: 'No Badge',
},
},
};

type Story = StoryObj<typeof Breadcrumb>;
Expand All @@ -20,6 +65,7 @@ export const Default: Story = {
onEdit: async () => action('onEdit'),
},
pathname: '/linodes/9872893679817/test/lastcrumb',
crumbOverrides: noBadgeCrumbs,
},
render: (args) => <Breadcrumb {...args} />,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const StyledPreContainerDiv = styled('div', { label: 'StyledDiv' })({
alignItems: 'center',
display: 'flex',
flexWrap: 'wrap',
minHeight: 48,
minHeight: 34,
});

export const StyledRootDiv = styled('div', { label: 'StyledRootDiv' })(
Expand Down
11 changes: 6 additions & 5 deletions packages/manager/src/components/Breadcrumb/Crumbs.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ import { styled } from '@mui/material';

export const StyledTypography = styled(Typography, {
label: 'StyledTypography',
})(({}) => ({
})(({ theme }) => ({
'&:hover': {
textDecoration: 'underline',
},
fontSize: '1.125rem',
fontSize: '1rem',
lineHeight: 'normal',
textTransform: 'capitalize',
whiteSpace: 'nowrap',
color: theme.tokens.breadcrumb.LastItem.Text,
}));

export const StyledSlashTypography = styled(Typography, {
label: 'StyledSlashTypography',
})(({ theme }) => ({
color: theme.textColors.tableHeader,
fontSize: 20,
marginLeft: 2,
marginRight: 2,
fontSize: 16,
marginLeft: 4,
marginRight: 4,
}));

export const StyledDiv = styled('div', { label: 'StyledDiv' })({
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/Breadcrumb/Crumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { EditableProps, LabelProps } from './types';
import type { LinkProps } from 'react-router-dom';

export interface CrumbOverridesProps {
label?: string;
label?: string | React.ReactNode;
linkTo?: LinkProps['to'];
noCap?: boolean;
position: number;
Expand Down
13 changes: 9 additions & 4 deletions packages/manager/src/components/Breadcrumb/FinalCrumb.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ export const StyledEditableText = styled(EditableText, {
'& > div': {
width: 250,
},
marginLeft: `-${theme.spacing()}`,
'& .breadcrumb-text': {
color: theme.tokens.breadcrumb.Normal.Text.Default,
fontSize: '1rem !important',
paddingLeft: 0,
},
}));

export const StyledH1Header = styled(H1Header, { label: 'StyledH1Header' })(
({ theme }) => ({
color: theme.textColors.tableStatic,
fontSize: '1.125rem',
color: theme.tokens.breadcrumb.Normal.Text.Default,
fontSize: '1rem',
paddingLeft: 0,
textTransform: 'capitalize',
[theme.breakpoints.up('lg')]: {
fontSize: '1.125rem',
fontSize: '1rem',
},
})
);
1 change: 1 addition & 0 deletions packages/manager/src/components/Breadcrumb/FinalCrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const FinalCrumb = React.memo((props: Props) => {
disabledBreadcrumbEditButton={disabledBreadcrumbEditButton}
errorText={onEditHandlers.errorText}
handleAnalyticsEvent={onEditHandlers.handleAnalyticsEvent}
isBreadcrumb
onCancel={onEditHandlers.onCancel}
onEdit={onEditHandlers.onEdit}
text={onEditHandlers.editableTextTitle}
Expand Down
11 changes: 9 additions & 2 deletions packages/ui/src/components/EditableText/EditableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ interface BaseProps extends Omit<TextFieldProps, 'label'> {
* Optional suffix to append to the text when it is not in editing mode
*/
textSuffix?: string;
/**
* Whether this EditableText is used as a breadcrumb
*/
isBreadcrumb?: boolean;
Comment thread
bill-akamai marked this conversation as resolved.
}

interface PropsWithoutLink extends BaseProps {
Expand Down Expand Up @@ -173,6 +177,7 @@ export const EditableText = (props: EditableTextProps) => {
disabledBreadcrumbEditButton,
errorText,
handleAnalyticsEvent,
isBreadcrumb,
labelLink,
onCancel,
onEdit,
Expand Down Expand Up @@ -237,7 +242,7 @@ export const EditableText = (props: EditableTextProps) => {
};
const labelText = (
<H1Header
className={classes.root}
className={`${classes.root} ${isBreadcrumb ? 'breadcrumb-text' : ''}`}
Comment thread
bill-akamai marked this conversation as resolved.
Outdated
data-qa-editable-text
title={`${text}${textSuffix ?? ''}`}
/>
Expand Down Expand Up @@ -272,7 +277,9 @@ export const EditableText = (props: EditableTextProps) => {
<TextField
{...rest}
inputProps={{
className: classes.input,
className: `${classes.input} ${
isBreadcrumb ? 'breadcrumb-text' : ''
Comment thread
bill-akamai marked this conversation as resolved.
Outdated
}`,
}}
InputProps={{ className: classes.inputRoot }}
// eslint-disable-next-line
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/foundations/themes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Background,
Badge,
Border,
Breadcrumb,
Button,
Calendar,
Color,
Expand Down Expand Up @@ -1040,6 +1041,7 @@ export const darkTheme: ThemeOptions = {
action: Action,
background: Background,
border: Border,
breadcrumb: Breadcrumb,
calendar: Calendar,
content: Content,
dropdown: Dropdown,
Expand Down
5 changes: 5 additions & 0 deletions packages/ui/src/foundations/themes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import type {
GlobalFooterTypes as GlobalFooterTypesLight,
GlobalHeaderTypes,
InteractionTypes as InteractionTypesLight,
BreadcrumbTypes as BreadcrumbTypesLight,
RadiusTypes,
SearchTypes as SearchTypesLight,
SideNavigationTypes as SideNavigationTypesLight,
Expand All @@ -47,6 +48,7 @@ import type {
ActionTypes as ActionTypesDark,
BackgroundTypes as BackgroundTypesDark,
BorderTypes as BorderTypesDark,
BreadcrumbTypes as BreadcrumbTypesDark,
CalendarTypes as CalendarTypesDark,
ContentTypes as ContentTypesDark,
DropdownTypes as DropdownTypesDark,
Expand All @@ -67,6 +69,7 @@ type AccentTypes = MergeTypes<AccentTypesLight, AccentTypesDark>;
type ActionTypes = MergeTypes<ActionTypesLight, ActionTypesDark>;
type BackgroundTypes = MergeTypes<BackgroundTypesLight, BackgroundTypesDark>;
type BorderTypes = MergeTypes<BorderTypesLight, BorderTypesDark>;
type BreadcrumbTypes = MergeTypes<BreadcrumbTypesLight, BreadcrumbTypesDark>;
type ContentTypes = MergeTypes<ContentTypesLight, ContentTypesDark>;
type ElevationTypes = MergeTypes<ElevationTypesLight, ElevationTypesDark>;
type CalendarTypes = MergeTypes<CalendarTypesLight, CalendarTypesDark>;
Expand Down Expand Up @@ -147,6 +150,7 @@ declare module '@mui/material/styles/createTheme' {
// ---- Global tokens: theme agnostic ----
border: BorderTypes;
borderRadius: BorderRadiusTypes;
breadcrumb: BreadcrumbTypes;
calendar: CalendarTypes;
chart: ChartTypes;
color: ColorTypes;
Expand Down Expand Up @@ -193,6 +197,7 @@ declare module '@mui/material/styles/createTheme' {
border?: BorderTypes;
// ---- Global tokens: theme agnostic ----
borderRadius?: BorderRadiusTypes;
breadcrumb?: BreadcrumbTypes;
calendar?: CalendarTypes;
chart?: ChartTypes;
color?: ColorTypes;
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/foundations/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Background,
Border,
BorderRadius,
Breadcrumb,
Button,
Calendar,
Chart,
Expand Down Expand Up @@ -1804,6 +1805,7 @@ export const lightTheme: ThemeOptions = {
background: Background,
border: Border,
borderRadius: BorderRadius,
breadcrumb: Breadcrumb,
calendar: Calendar,
chart: Chart,
color: Color,
Expand Down
Loading