forked from owncloud/web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add viewMode toggle for condensed resource table (owncloud#7976)
- Loading branch information
1 parent
5667b5f
commit e013d4b
Showing
14 changed files
with
169 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Enhancement: Add switch to enable condensed resource table | ||
|
||
We've added a switch to have a more condensed resource table. | ||
The change gets saved to the route and persisted across resource navigation. | ||
|
||
https://github.com/owncloud/web/pull/7976 | ||
https://github.com/owncloud/web/issues/6380 |
5 changes: 5 additions & 0 deletions
5
packages/design-system/changelog/unreleased/enhancement-condensed-menu-item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Enhancement: Add condensed menu icon | ||
|
||
We added a new menu icon for the switch between condensed and regular resource table. | ||
|
||
https://github.com/owncloud/web/pull/7976 |
6 changes: 6 additions & 0 deletions
6
packages/design-system/src/assets/icons/menu-line-condensed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export abstract class ViewModeConstants { | ||
static readonly default: string = 'resource-table' | ||
static readonly queryName: string = 'view-mode' | ||
static readonly condensedTable: string = 'resource-table-condensed' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './constants' | ||
export * from './useViewMode' |
15 changes: 15 additions & 0 deletions
15
packages/web-app-files/src/composables/viewMode/useViewMode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { computed, ComputedRef, unref } from 'vue' | ||
import { queryItemAsString, useRouteQueryPersisted } from 'web-pkg/src/composables' | ||
import { ViewModeConstants } from './constants' | ||
|
||
export function useViewMode<T>(options: ComputedRef<string>): ComputedRef<string> { | ||
if (options) { | ||
return computed(() => unref(options)) | ||
} | ||
|
||
const viewModeQuery = useRouteQueryPersisted({ | ||
name: ViewModeConstants.queryName, | ||
defaultValue: ViewModeConstants.default | ||
}) | ||
return computed(() => queryItemAsString(unref(viewModeQuery))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/web-app-files/tests/unit/components/AppBar/__snapshots__/ViewOptions.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ViewOptions initially shows normal resource-table by default 1`] = ` | ||
<div data-testid="viewmode-switch-buttons" class="oc-button-group oc-visible@s oc-mr-s"> | ||
<oc-button-stub appearance="outline"> | ||
<oc-icon-stub name="menu-line-condensed" fill-type="none" size="small"></oc-icon-stub> | ||
</oc-button-stub> | ||
<oc-button-stub appearance="filled"> | ||
<oc-icon-stub name="menu-line" fill-type="none" size="small"></oc-icon-stub> | ||
</oc-button-stub> | ||
</div> | ||
`; | ||
|
||
exports[`ViewOptions toggles between normal and condensed resource-table upon clicking the respective buttons 1`] = ` | ||
<div data-testid="viewmode-switch-buttons" class="oc-button-group oc-visible@s oc-mr-s"><button type="button" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-filled"> | ||
<oc-icon-stub name="menu-line-condensed" filltype="none" accessiblelabel="" type="span" size="small" variation="passive" color=""></oc-icon-stub> | ||
</button> <button type="button" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-outline"> | ||
<oc-icon-stub name="menu-line" filltype="none" accessiblelabel="" type="span" size="small" variation="passive" color=""></oc-icon-stub> | ||
</button></div> | ||
`; | ||
|
||
exports[`ViewOptions toggles between normal and condensed resource-table upon clicking the respective buttons 2`] = ` | ||
<div data-testid="viewmode-switch-buttons" class="oc-button-group oc-visible@s oc-mr-s"><button type="button" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-outline"> | ||
<oc-icon-stub name="menu-line-condensed" filltype="none" accessiblelabel="" type="span" size="small" variation="passive" color=""></oc-icon-stub> | ||
</button> <button type="button" class="oc-button oc-rounded oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-filled"> | ||
<oc-icon-stub name="menu-line" filltype="none" accessiblelabel="" type="span" size="small" variation="passive" color=""></oc-icon-stub> | ||
</button></div> | ||
`; |