Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/molecules/Select/GroupedSelectPersistent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { SelectOptionRequired } from 'src/molecules';
import { useGroupedSelectItems } from 'src/molecules/Select/Select.hooks';
import {
GroupTitle,
NoItemsFoundText,
PersistentGroupsWrapper,
PersistentNoItemsFoundText,
} from 'src/molecules/Select/Select.styles';
import {
CustomMenuItemComponentProps,
Expand Down Expand Up @@ -38,7 +38,7 @@ export const GroupedSelectPersistent = <T extends SelectOptionRequired>(
const { filteredGroups, filteredGroupSum } = useGroupedSelectItems(props);

if (filteredGroups.length === 0) {
return <NoItemsFoundText>No items found</NoItemsFoundText>;
return <PersistentNoItemsFoundText>No items found</PersistentNoItemsFoundText>;
}

// This case never happens, since there is a check in select.tsx. This check gives the correct typescript inference.
Expand Down
6 changes: 4 additions & 2 deletions src/molecules/Select/ListSelectPersistent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { capitalize } from 'src/atoms';
import { useListSelectItems } from 'src/molecules/Select/Select.hooks';
import {
GroupTitle,
NoItemsFoundText,
NoTagFoundText,
PersistentNoItemsFoundText,
} from 'src/molecules/Select/Select.styles';
import {
CustomMenuItemComponentProps,
Expand Down Expand Up @@ -40,7 +40,9 @@ export const ListSelectPersistent = <T extends SelectOptionRequired>(
const { filteredItems } = useListSelectItems(props);

if (filteredItems.length === 0 && (!props.onAddItem || search === '')) {
return <NoItemsFoundText>No items found</NoItemsFoundText>;
return (
<PersistentNoItemsFoundText>No items found</PersistentNoItemsFoundText>
);
}

const hasNestedItems = filteredItems.some(
Expand Down
20 changes: 18 additions & 2 deletions src/molecules/Select/Select.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { Chip } from 'src/molecules/Chip/Chip';

import styled, { css } from 'styled-components';

// Persistent mode keeps an explicit item height so the empty state matches without layout shift
const PERSISTENT_ITEM_HEIGHT = `calc(${spacings.medium} * 2 + 24px)`; // 2×spacings.medium padding + 24px line-height

interface WrapperProps {
$showBackgroundColor: boolean;
}
Expand Down Expand Up @@ -336,6 +339,7 @@ const PersistentListItem = styled.button`
padding: ${spacings.medium} ${spacings.medium};
justify-content: flex-start;
gap: ${spacings.small};
min-height: ${PERSISTENT_ITEM_HEIGHT};
box-sizing: border-box;
svg {
flex-shrink: 0;
Expand Down Expand Up @@ -382,8 +386,19 @@ const NoTagFoundText = styled(Typography)`
margin: ${spacings.medium};
`;

const NoItemsFoundText = styled(Typography)`
margin-left: ${spacings.medium};
const NoItemsFoundText = styled(Typography).attrs({
group: 'navigation',
variant: 'menu_title',
})`
display: flex;
align-items: center;
margin: 0;
padding: ${spacings.medium};
box-sizing: border-box;
`;

const PersistentNoItemsFoundText = styled(NoItemsFoundText)`
min-height: ${PERSISTENT_ITEM_HEIGHT};
`;

const StyledMenu = styled(EDSMenu)`
Expand Down Expand Up @@ -428,6 +443,7 @@ export {
StyledMenu,
NoTagFoundText,
NoItemsFoundText,
PersistentNoItemsFoundText,
PlaceholderText,
PersistentListItem,
PersistentComboBoxWrapper,
Expand Down
Loading