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

Enhancement: Give OcModal the option to use OcContextualHelper #2325

Merged
merged 2 commits into from
Sep 30, 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
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-add-contextual-helper-modal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Give OcModal the option to use OcContextualHelper

We've added the option for OcModal to use OcContextualHelper

https://github.com/owncloud/owncloud-design-system/pull/2325
https://github.com/owncloud/web/issues/6892
34 changes: 34 additions & 0 deletions src/components/organisms/OcModal/OcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
:aria-label="checkboxLabel"
/>
</div>
<div v-if="contextualHelperData" class="oc-modal-body-contextual-helper">
<span class="text" v-text="contextualHelperLabel" />
<oc-contextual-helper class="oc-pl-xs" v-bind="contextualHelperData" />
</div>
<div class="oc-modal-body-actions oc-flex oc-flex-right">
<oc-button
class="oc-modal-body-actions-cancel"
Expand Down Expand Up @@ -153,6 +157,22 @@ export default {
required: false,
default: "",
},
/**
* Contextual helper label
*/
contextualHelperLabel: {
type: String,
required: false,
default: "",
},
/**
* Contextual helper data
*/
contextualHelperData: {
type: Object,
required: false,
default: null,
},
/**
* Text of the cancel button
*/
Expand Down Expand Up @@ -467,6 +487,10 @@ export default {
margin-top: var(--oc-space-small);
}

&-contextual-helper {
margin-bottom: var(--oc-space-medium);
}

&-input {
/* FIXME: this is ugly, but required so that the bottom padding doesn't look off when reserving vertical space for error messages below the input. */
margin-bottom: -20px;
Expand Down Expand Up @@ -548,6 +572,16 @@ export default {
button-secondary-text="Accept some"
class="oc-mb-l oc-position-relative"
/>
<oc-modal
icon="information"
title="Accept terms of use"
message="Do you accept our terms of use?"
button-cancel-text="Decline"
button-confirm-text="Accept"
contextual-helper-label="I need more information?"
:contextual-helper-data="{ title: 'This is more information' }"
class="oc-mb-l oc-position-relative"
/>
```

```js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ exports[`OcModal displays input 1`] = `
<div class="oc-modal-body">
<oc-text-input-stub id="oc-textinput-1" type="text" value="New folder" clearbuttonaccessiblelabel="" label="Folder name" fixmessageline="true" class="oc-modal-body-input"></oc-text-input-stub>
<!---->
<!---->
<div class="oc-modal-body-actions oc-flex oc-flex-right">
<oc-button-stub type="button" size="medium" submit="button" variation="passive" appearance="outline" justifycontent="center" gapsize="medium" class="oc-modal-body-actions-cancel">Cancel</oc-button-stub>
<!---->
Expand All @@ -33,6 +34,7 @@ exports[`OcModal hides icon if not specified 1`] = `
<div class="oc-modal-body">
<p class="oc-modal-body-message">Example message</p>
<!---->
<!---->
<div class="oc-modal-body-actions oc-flex oc-flex-right">
<oc-button-stub type="button" size="medium" submit="button" variation="passive" appearance="outline" justifycontent="center" gapsize="medium" class="oc-modal-body-actions-cancel">Cancel</oc-button-stub>
<!---->
Expand All @@ -55,6 +57,7 @@ exports[`OcModal matches snapshot 1`] = `
<div class="oc-modal-body">
<p class="oc-modal-body-message">Example message</p>
<!---->
<!---->
<div class="oc-modal-body-actions oc-flex oc-flex-right">
<oc-button-stub type="button" size="medium" submit="button" variation="passive" appearance="outline" justifycontent="center" gapsize="medium" class="oc-modal-body-actions-cancel">Cancel</oc-button-stub>
<!---->
Expand All @@ -79,6 +82,7 @@ exports[`OcModal overrides props message with slot 1`] = `
<p>Slot message</p>
</div>
<!---->
<!---->
<div class="oc-modal-body-actions oc-flex oc-flex-right">
<oc-button-stub type="button" size="medium" submit="button" variation="passive" appearance="outline" justifycontent="center" gapsize="medium" class="oc-modal-body-actions-cancel">Cancel</oc-button-stub>
<!---->
Expand Down