Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
changes js to css logic
  • Loading branch information
TenzDelek committed Jul 21, 2024
commit 80aeab18277fd18fd7701c1290766cb5af6ffc63
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.item {
@apply flex
max-w-96
items-center
gap-5
truncate
text-sm
font-medium;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.link {
@apply w-full truncate;

&.active {
@apply rounded
bg-green-600
Expand Down
11 changes: 1 addition & 10 deletions apps/site/components/Common/Breadcrumbs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({
const lengthOffset = maxLength - totalLength;
const isOverflow = lengthOffset < 0;

const formatLabelWithWordCount = (label: string, maxWords: number) => {
const words = label.split(' ');
if (words.length > maxWords) {
return <>{words.slice(0, maxWords).join(' ')} ...</>;
}
return label;
};
const items = useMemo(
() =>
links.map((link, index, items) => {
Expand All @@ -45,8 +38,6 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({
// We add 1 here to take into account of the truncated breadcrumb.
position <= Math.abs(lengthOffset) + 1 && isOverflow && !isLastItem;

const labelString = link.label.toString();
const formattedLabel = formatLabelWithWordCount(labelString, 6);
return (
<BreadcrumbItem
key={link.label.toString()}
Expand All @@ -55,7 +46,7 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({
position={position + +!hideHome}
>
<BreadcrumbLink href={link.href} active={isLastItem}>
<div className=" text-center">{formattedLabel}</div>
{link.label}
</BreadcrumbLink>
</BreadcrumbItem>
);
Expand Down