Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.

Conversation

varun257
Copy link
Contributor

@varun257 varun257 commented Apr 26, 2018

UU-832

feature: oui clipboard component

change oui tooltip from one time binding to one way binding so as to reuse tooltip
add new component clipboard

Demo: http://feature_oui_clipboard_build.ui-kit.ovh/#!/oui-angular/clipboard

### Default

```html:preview
<oui-clipboard data-text="copy this text">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike in our managers, we don't prefixing with data- in our templates

### Clipboard contained in width of the parent

```html:preview
<div style="width:300px;">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No inline style in our preview.
Why not about using oui-field for this case ? It has sizing attribute :)

Or you can use helpers classes for our documentation.
See oui-doc-preview-only and oui-doc-preview-only-keep-children.

<oui-clipboard data-text="copy this text">
</oui-clipboard>
</div>
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API table of the component attributes is missing

export default {
template,
controller,
controllerAs: "$clipctrl",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need, we use the default one $ctrl for our template

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip has $ctrl as controller because of which i lose scope of the parent controller. So had to rename this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. In this case, I think we should rename the controller of the tooltip instead with $tooltipCtrl.

this.ouiClipboardConfiguration = ouiClipboardConfiguration;
}

$postLink () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $onInit
$postLink should only be use for DOM modifications :)

data-ng-value="$clipctrl.text"
data-oui-tooltip="{{$clipctrl.tooltipText}}"
readonly>
<span class="oui-clipboard__icon" data-ng-if="$clipctrl.status === 'initial'"><i class="oui-icon oui-icon-copy-normal" aria-hidden="true"></i></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the icon must be clickable, this should be in a <button>

@@ -0,0 +1,12 @@
<div class="oui-clipboard">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class could be added on the root component <oui-clipboard>, to avoid this DIV.
See our use of $postLink for that :)

@@ -0,0 +1,12 @@
<div class="oui-clipboard">
<div class="oui-clipboard__container">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use oui-input-group oui-input-group_button ? We could even go with a new modifier if necessary (eg. oui-input-group_clipboard)

return this;
}

setStatus (status) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary ? Do we have already a use of this method ?

return this;
}

setAction (copy) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this one too :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using these functions in spec for test cases

@varun257
Copy link
Contributor Author

varun257 commented May 2, 2018

Hi @AxelPeter, Have done the changes as suggested. Please check if this is okay now

@whispyy whispyy force-pushed the feature/oui-clipboard branch from b68b1db to 0db6e48 Compare May 17, 2018 20:09
@varun257 varun257 changed the base branch from master to develop May 21, 2018 05:41
@AxelPeter AxelPeter force-pushed the feature/oui-clipboard branch from eb0c18e to b872a1d Compare May 30, 2018 13:00
contenteditable>
<button class="oui-button"><i class="oui-icon oui-icon-copy-normal" aria-hidden="true"></i></button>
<button class="oui-button">
<span class="oui-icon oui-icon-copy-normal"></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-hidden="true"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a description on this button, like "Copy" or something like this :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I already told him face to face

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an aria-label with the tooltip text "Copy to clipboard"

contenteditable>
<button class="oui-button"><i class="oui-icon oui-icon-copy-normal" aria-hidden="true"></i></button>
<button class="oui-button">
<span class="oui-icon oui-icon-copy-normal"></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a description on this button, like "Copy" or something like this :)

copyToClipboardLabel: "Copy to Clipboard",
copiedLabel: "Copied",
notSupported: "Not supported. Please copy the text manually"
notSupported: "Copy to Clipboard not supported. Please copy the text manually"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clipboard

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was like this in the guidelines :)

@AxelPeter AxelPeter force-pushed the feature/oui-clipboard branch 2 times, most recently from e210475 to c18a606 Compare June 4, 2018 11:44
@AxelPeter AxelPeter dismissed stale reviews from FredericEspiau and jleveugle June 4, 2018 11:45

Made the change

varun257 and others added 5 commits June 6, 2018 10:31
migrate cui clipboard to oui-clipboard
design changes as per cx specs
tooltip added on hover of the element
tooltip bindin chaned to one way binding from one time binding

cui clipboard to oui
add default parameters
remove unnecessary code
add width based html in readme

cui clipboard to oui
rewrite html for clipboard with input group
rename tooltip and clipboard controller
add api for tooltip and clipboard

cui clipboard to oui
fix tests
add test for id and name attributes
@AxelPeter AxelPeter force-pushed the feature/oui-clipboard branch from c18a606 to eabf9d7 Compare June 6, 2018 08:34
@AxelPeter AxelPeter merged commit 2546d9c into develop Jun 6, 2018
@AxelPeter AxelPeter deleted the feature/oui-clipboard branch June 6, 2018 08:35
neolitec pushed a commit that referenced this pull request Jun 21, 2018
* feat: oui clipboard

migrate cui clipboard to oui-clipboard
design changes as per cx specs
tooltip added on hover of the element
tooltip bindin chaned to one way binding from one time binding

cui clipboard to oui

* feat: oui clipboard

add default parameters
remove unnecessary code
add width based html in readme

cui clipboard to oui

* feat: oui clipboard

rewrite html for clipboard with input group
rename tooltip and clipboard controller
add api for tooltip and clipboard

cui clipboard to oui

* feat(oui-clipboard): add attributes id, name

fix tests
add test for id and name attributes

* refactor(oui-clipboard): replicate BEM changes

* chore(oui-clipboard): code review

* chore: code review

* feat(oui-clipboard): use of clipboardjs library

* feat(oui-clipboard): add fallback if no support

* chore(oui-clipboard): update tooltip text

* chore: code review
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

6 participants