Skip to content

Commit

Permalink
feat(docs): Copying prop names to clipboard (quasarframework#13809)
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosPaunovic authored Jul 14, 2022
1 parent ad0ec0b commit 168a5a5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docs/src/components/DocApiEntry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { h } from 'vue'
import { QBadge } from 'quasar'
import { QBadge, Notify } from 'quasar'
import { copyToClipboard } from 'assets/page-utils'

import './DocApiEntry.sass'

Expand Down Expand Up @@ -79,9 +80,10 @@ function getExtendedNameDiv (label, level, type, required, addedIn) {

const child = [
h(QBadge, {
color: NAME_PROP_COLOR[ level ],
onClick: () => { copyPropName(label) },
label,
style: 'font-size: 1em; line-height: 1.2em'
color: NAME_PROP_COLOR[ level ],
style: 'cursor: pointer; font-size: 1em; line-height: 1.2em'
}),
suffix
]
Expand Down Expand Up @@ -262,6 +264,17 @@ function getProp (prop, propName, level, onlyChildren) {
: child
}

function copyPropName (propName) {
copyToClipboard(propName)

Notify.create({
message: 'Prop name has been copied to clipboard.',
position: 'top',
actions: [{ icon: 'cancel', color: 'white', dense: true, round: true }],
timeout: 2000
})
}

const describe = {}

describe.props = props => {
Expand Down

0 comments on commit 168a5a5

Please sign in to comment.