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

Add OcInfoDrop component #2286

Merged
merged 8 commits into from
Aug 5, 2022
Merged
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
5 changes: 5 additions & 0 deletions changelog/unreleased/enhancement-add-oc-info-drop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add OcInfoDrop

We've added the new component OcInfoDrop, which will be consumed by the OcContextualHelper component.

https://github.com/owncloud/owncloud-design-system/pull/2286
175 changes: 0 additions & 175 deletions src/components/atoms/OcContextualHelper/OcContextualHelper.vue

This file was deleted.

135 changes: 135 additions & 0 deletions src/components/molecules/OcContextualHelper/OcContextualHelper.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<template>
<div class="oc-contextual-helper">
<oc-button :id="buttonId" appearance="raw">
<oc-icon name="question" fill-type="line" size="small" />
</oc-button>
<oc-info-drop :drop-id="dropId" :toggle="toggleId" v-bind="$props" />
</div>
</template>

<script>
import uniqueId from "../../../utils/uniqueId"
import OcButton from "../../atoms/OcButton/OcButton.vue"
import OcIcon from "../../atoms/OcIcon/OcIcon.vue"
import OcInfoDrop from "../../molecules/OcInfoDrop/OcInfoDrop.vue"

export default {
name: "OcContextualHelper",
status: "unreleased",
components: { OcButton, OcIcon, OcInfoDrop },
props: {
/**
* Title
*/
title: {
type: String,
required: false,
default: "",
},
/**
* Text at the beginning
*/
text: {
type: String,
required: false,
default: "",
},
/**
* List element
*/
list: {
type: Array,
required: false,
default: () => [],
},
/**
* Text at the end
*/
endText: {
type: String,
required: false,
default: "",
},
/**
* Read more link at the end
*/
readMoreLink: {
type: String,
required: false,
default: "",
},
},
computed: {
dropId() {
return uniqueId("oc-contextual-helper-")
},
buttonId() {
return `${this.dropId}-button`
},
toggleId() {
return `#${this.buttonId}`
},
},
}
</script>

<style lang="scss">
.oc-contextual-helper {
display: inline-block;
.oc-button {
vertical-align: middle;
}
}
</style>

<docs>
## Examples
A simple example, using only text.
```js
<template>
<div>
<oc-contextual-helper v-bind="helperContent"/>
</div>
</template>
<script>
export default {
computed: {
helperContent() {
return {
text: "Invite persons or groups to access this file or folder.",
}
}
},
}
</script>
```

An example using Title, Text, List, End-Text and Read-More-Link properties.
```js
<template>
<div>
<oc-contextual-helper v-bind="helperContent"/>
</div>
</template>
<script>
export default {
computed: {
helperContent() {
return {
title: 'Choose how access is granted ',
text: "Share a file or folder by link",
list: [
{text: "Only invited people can access", headline: true},
{text: "Only people from the list \"Invited people\" can access. If there is no list, no people are invited yet."},
{text: "Everyone with the link", headline: true },
{text: "Everyone with the link can access. Note: If you share this link with people from the list \"Invited people\", they need to login-in so that their individual assigned permissions can take effect. If they are not logged-in, the permissions of the link take effect." }
],
endText: "Invited persons can not see who else has access",
readMoreLink: "https://owncloud.design"
}
}
},
}
</script>
```
</docs>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import OcContextualHelper from "./OcContextualHelper.vue"
import OcInfoDrop from "./OcInfoDrop.vue"
import { createLocalVue, shallowMount } from "@vue/test-utils"
import GetTextPlugin from "vue-gettext"

Expand All @@ -8,9 +8,9 @@ localVue.use(GetTextPlugin, {
silent: true,
})

describe("OcContextualHelper", () => {
describe("OcInfoDrop", () => {
function getWrapperWithProps(props) {
return shallowMount(OcContextualHelper, {
return shallowMount(OcInfoDrop, {
localVue: localVue,
propsData: props,
stubs: {
Expand Down
Loading