Skip to content

Commit

Permalink
Merge pull request #1369 from statisticsnorway/MIM-2040-breadcrumb-co…
Browse files Browse the repository at this point in the history
…de-refined

Link element instead of Button - for breadcrumb mobileCompressedView
  • Loading branch information
Carl-OW authored Nov 11, 2024
2 parents 8ad26fc + 214e971 commit 4739526
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@statisticsnorway/ssb-component-library",
"version": "2.4.0",
"version": "2.4.1",
"description": "Component library for SSB (Statistics Norway)",
"main": "lib/bundle.js",
"scripts": {
Expand Down
21 changes: 0 additions & 21 deletions src/components/Breadcrumb/_breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,3 @@
font-stretch: normal;
line-height: 1.25;
}

.ssb-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
content: none !important;
}

.breadcrumb-button {
cursor: pointer;
color: inherit;
text-decoration: none;
background: none;
border: none;
padding: 0;
font-size: 16px;
font-family: 'Open Sans', sans-serif;

&:focus {
outline: 2px solid rgb(146 114 252 / 100%);
outline-offset: 4px;
border-radius: 2px;
}
}
13 changes: 3 additions & 10 deletions src/components/Breadcrumb/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@ const Breadcrumb = ({ className, items, mobileCompressedView = false }) => {

const shouldShowCompressed = isMobile && mobileCompressedView && items.length > 1

const handleNavigation = (link) => {
window.location.href = link
}

return (
<div className={`ssb-breadcrumbs${className ? ` ${className}` : ''}`}>
{shouldShowCompressed ? (
<div className='breadcrumb-item' style={{ display: 'flex', alignItems: 'center' }}>
<ArrowLeft style={{ color: '#00824d', marginRight: '10px' }} />
<button onClick={() => handleNavigation(items[items.length - 2].link)} className='breadcrumb-button'>
{items[items.length - 2].text}
</button>
</div>
<Link href={items[items.length - 2].link} icon={<ArrowLeft size={20} />}>
{items[items.length - 2].text}
</Link>
) : (
<>
{items.slice(0, -1).map((item) => (
Expand Down

0 comments on commit 4739526

Please sign in to comment.