Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Redesign OcBreadcrumb (#1975)
Browse files Browse the repository at this point in the history
* Redesign OcBreadcrumb

* Add changelog, linting, snapshots

* Fix three-dots hover color

* Fix OcBreadcrumb example

* remove unused class

* Update breadcrumb example docs

Co-authored-by: Pascal Wengerter <pascal@wengerter.info>
  • Loading branch information
lookacat and pascalwengerter authored Feb 24, 2022
1 parent fd3c9ff commit 7d8ef69
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 35 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/enhancement-redesign-breadcrumb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Redesign OcBreadcrumb

We've adjustet the look of the OcBreadcrumb
to fit the Redesign

https://github.com/owncloud/web/issues/6218
https://github.com/owncloud/owncloud-design-system/pull/1975
43 changes: 24 additions & 19 deletions src/components/molecules/OcBreadcrumb/OcBreadcrumb.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<template>
<nav :class="`oc-breadcrumb oc-breadcrumb-${variation}`">
<ol class="oc-breadcrumb-list">
<ol class="oc-breadcrumb-list oc-mb-s">
<li v-for="(item, index) in items" :key="index" class="oc-breadcrumb-list-item">
<router-link v-if="item.to" :aria-current="getAriaCurrent(index)" :to="item.to">
{{ item.text }}
<span>{{ item.text }}</span>
</router-link>
<oc-icon
v-if="item.to"
color="var(--oc-color-text-default)"
name="arrow-right-s"
fill-type="line"
/>
<oc-button
v-else-if="item.onClick"
:aria-current="getAriaCurrent(index)"
Expand All @@ -21,7 +27,7 @@
:aria-label="contextMenuLabel"
appearance="raw"
>
<oc-icon name="more-2" />
<oc-icon name="more-2" color="var(--oc-color-text-default)" />
</oc-button>
<oc-drop
drop-id="oc-breadcrumb-contextmenu"
Expand Down Expand Up @@ -176,6 +182,11 @@ export default {
#oc-breadcrumb-contextmenu-trigger > span {
vertical-align: middle;
border: 3px solid transparent;
&:hover {
background-color: var(--oc-color-background-hover);
border-radius: 3px;
}
}
#oc-breadcrumb-contextmenu li button {
Expand All @@ -190,30 +201,25 @@ export default {
> li button,
> li span,
> :nth-child(n + 2)::before {
color: var(--oc-color-text-muted);
}
> :nth-child(n + 2)::before {
content: "/";
color: var(--oc-color-text-default);
display: inline-block;
margin: 0 var(--oc-space-small) 0 var(--oc-space-xsmall);
font-size: 0.875rem;
vertical-align: middle;
line-height: normal;
}
> :last-child > span {
color: var(--oc-color-text-default);
}
> li a:hover,
> li span:not([aria-current="page"]):hover,
> li span:not([aria-current="page"]):not(.oc-icon):hover,
> li button:hover {
color: var(--oc-color-swatch-primary-default);
text-decoration: underline;
}
}
/* stylelint-disable */
&-list-item {
&::before,
a,
button,
span {
Expand All @@ -222,7 +228,6 @@ export default {
}
&-lead &-list-item {
&::before,
a,
button,
span {
Expand All @@ -243,7 +248,7 @@ export default {
> li a,
> li button,
> li span {
color: var(--oc-color-text-muted);
color: var(--oc-color-text-default);
font-size: 0.875rem;
}
Expand Down Expand Up @@ -282,13 +287,13 @@ export default {
<template>
<section>
<div>
<oc-breadcrumb :items="items" class="oc-mb" />
<oc-breadcrumb :items="items" />
</div>
<div>
<oc-breadcrumb :items="items" variation="lead" />
<oc-breadcrumb :items="items" class="oc-mt-l">
<oc-breadcrumb :items="items" >
<template v-slot:contextMenu>
<p>I'm an example item</p>
<p class="oc-my-rm">I'm an example item</p>
</template>
</oc-breadcrumb>
</div>
Expand All @@ -300,8 +305,8 @@ export default {
return {
items: [
{text:'First folder',to:{path:'folder'}},
{text:'Subfolder', onClick:() => alert('Breadcrumb clicked!')},
{text:'Deep',to:{path:'folder'}},
{text:'Subfolder', to: {path: 'subfolder'}},
{text:'Deep',to:{path:'deep'}},
{text:'Deeper ellipsize in responsive mode'},
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

exports[`OcBreadcrumb displays all items 1`] = `
<nav class="oc-breadcrumb oc-breadcrumb-default">
<ol class="oc-breadcrumb-list">
<ol class="oc-breadcrumb-list oc-mb-s">
<li class="oc-breadcrumb-list-item">
<router-link-stub tag="a" to="[object Object]">
First folder
</router-link-stub>
<router-link-stub tag="a" to="[object Object]"><span>First folder</span></router-link-stub>
<oc-icon-stub name="arrow-right-s" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)"></oc-icon-stub>
<!---->
</li>
<li class="oc-breadcrumb-list-item">
<!---->
<oc-button-stub type="button" size="medium" variation="passive" appearance="raw" justifycontent="center" gapsize="medium">
Subfolder
</oc-button-stub>
<!---->
</li>
<li class="oc-breadcrumb-list-item">
<router-link-stub tag="a" to="[object Object]">
Deep
</router-link-stub>
<router-link-stub tag="a" to="[object Object]"><span>Deep</span></router-link-stub>
<oc-icon-stub name="arrow-right-s" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)"></oc-icon-stub>
<!---->
</li>
<li class="oc-breadcrumb-list-item"><span aria-current="page" tabindex="-1">Deeper ellipsize in responsive mode</span>
<li class="oc-breadcrumb-list-item">
<!----> <span aria-current="page" tabindex="-1">Deeper ellipsize in responsive mode</span>
<!---->
</li>
</ol>
Expand Down Expand Up @@ -53,26 +53,26 @@ exports[`OcBreadcrumb displays all items 1`] = `

exports[`OcBreadcrumb sets correct variation 1`] = `
<nav class="oc-breadcrumb oc-breadcrumb-lead">
<ol class="oc-breadcrumb-list">
<ol class="oc-breadcrumb-list oc-mb-s">
<li class="oc-breadcrumb-list-item">
<router-link-stub tag="a" to="[object Object]">
First folder
</router-link-stub>
<router-link-stub tag="a" to="[object Object]"><span>First folder</span></router-link-stub>
<oc-icon-stub name="arrow-right-s" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)"></oc-icon-stub>
<!---->
</li>
<li class="oc-breadcrumb-list-item">
<!---->
<oc-button-stub type="button" size="medium" variation="passive" appearance="raw" justifycontent="center" gapsize="medium">
Subfolder
</oc-button-stub>
<!---->
</li>
<li class="oc-breadcrumb-list-item">
<router-link-stub tag="a" to="[object Object]">
Deep
</router-link-stub>
<router-link-stub tag="a" to="[object Object]"><span>Deep</span></router-link-stub>
<oc-icon-stub name="arrow-right-s" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)"></oc-icon-stub>
<!---->
</li>
<li class="oc-breadcrumb-list-item"><span aria-current="page" tabindex="-1">Deeper ellipsize in responsive mode</span>
<li class="oc-breadcrumb-list-item">
<!----> <span aria-current="page" tabindex="-1">Deeper ellipsize in responsive mode</span>
<!---->
</li>
</ol>
Expand Down

0 comments on commit 7d8ef69

Please sign in to comment.