consul/ui/packages/consul-ui/app/components/copy-button/index.hbs

30 lines
820 B
Handlebars
Raw Normal View History

2020-06-17 09:25:54 +00:00
<StateChart @src={{chart}} as |State Guard Action dispatch state|>
<Ref @target={{this}} @name="dispatch" @value={{dispatch}} />
2020-11-30 16:52:13 +00:00
<div
{{did-insert this.connect}}
{{will-destroy this.disconnect}}
class="copy-button"
id={{this.guid}}
...attributes
>
<button
title={{concat "Copy " @name " to the clipboard"}}
type="button"
class="copy-btn"
data-clipboard-text={{@value}}
...attributes
{{tooltip
(if (state-matches state 'success') (concat 'Copied ' @name '!!') 'There was a problem!')
options=(hash
trigger='manual'
showOnCreate=(not (state-matches state 'idle'))
delay=(array 0 3000)
onHidden=(action dispatch 'RESET')
)
}}
>
{{~yield~}}
</button>
2020-06-17 09:25:54 +00:00
</div>
</StateChart>