Skip to content

Commit

Permalink
create usage cards
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemitchel committed Dec 5, 2024
1 parent eebd402 commit 5487cc7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/variables/usage/card/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import DefineMap from 'can-define/map/map'
import Component from 'can-component'
import template from './card.stache'

export const UsageCardVM = DefineMap.extend('UsageCardVM', {
// passed in from parent
cardInfo: {},

isOpen: { default: true },

checkDetailToggle (el) {
this.isOpen = !el.hasAttribute('open')
}
}
)

export default Component.extend({
view: template,
leakScope: false,
ViewModel: UsageCardVM,
tag: 'usage-card'
})
16 changes: 16 additions & 0 deletions src/variables/usage/card/card.stache
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="page-toggle">
{{#if (isOpen)}}
<span class="glyphicon-down-open" aria-hidden="true"></span>
{{else}}
<span class="glyphicon-right-open" aria-hidden="true"></span>
{{/if}}

<details open on:click="checkDetailToggle(scope.element)">
<summary>{{cardInfo.pageName}}</summary>
<ul>
{{#each(cardInfo.page, item=value)}}
<li>{{item}}</li>
{{/each}}
</ul>
</details>
</div>

0 comments on commit 5487cc7

Please sign in to comment.