-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #875 from opencomponents/templates-ui
[DX-502] Add templates info into OC UI
- Loading branch information
Showing
4 changed files
with
79 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = vm => { | ||
const externalLink = ({ global, url }) => | ||
`<a href="${url}" target="_blank">${global}</a>`; | ||
|
||
const templateRow = ({ externals, type, version }) => { | ||
const externalLinks = externals.map(externalLink).join(', '); | ||
const externalsLabel = externalLinks ? `(Externals: ${externalLinks})` : ''; | ||
|
||
return `<div class="componentRow row table"> | ||
<p class="release"> | ||
<a href="https://www.npmjs.com/package/${type}" target="_blank">${type}@${version}</a> | ||
${externalsLabel} | ||
</p> | ||
</div> | ||
`; | ||
}; | ||
|
||
return `<div id="components-templates" class="box">${vm.templates | ||
.map(templateRow) | ||
.join('')}</div>`; | ||
}; |