-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/oui clipboard #174
Conversation
packages/oui-clipboard/README.md
Outdated
### Default | ||
|
||
```html:preview | ||
<oui-clipboard data-text="copy this text"> |
There was a problem hiding this comment.
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
packages/oui-clipboard/README.md
Outdated
### Clipboard contained in width of the parent | ||
|
||
```html:preview | ||
<div style="width:300px;"> |
There was a problem hiding this comment.
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
.
packages/oui-clipboard/README.md
Outdated
<oui-clipboard data-text="copy this text"> | ||
</oui-clipboard> | ||
</div> | ||
``` |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 () { |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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
Hi @AxelPeter, Have done the changes as suggested. Please check if this is okay now |
b68b1db
to
0db6e48
Compare
eb0c18e
to
b872a1d
Compare
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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aria-hidden="true"
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clipboard
There was a problem hiding this comment.
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 :)
e210475
to
c18a606
Compare
Made the change
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
c18a606
to
eabf9d7
Compare
* 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
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