Browse Source

Added package.json and modified README

master
chris 2 months ago
parent
commit
d1a3811f64
  1. 3
      README.md
  2. 23
      icons.js
  3. 21
      package.json

3
README.md

@ -1,3 +1,4 @@
# jpclwe-materialIcons # jpclwe-materialIcons
> jpc-like-website - extension
Extension that enables the user to use material-design icons from goole Extension that enables the user to use material-design icons from goole

23
icons.js

@ -1,5 +1,5 @@
/** /**
* check https://fonts.google.com/icons (20250302) * check https://fonts.google.com/icons (20250302)s
*/ */
const MaterialIcons = new CompelExtension(); const MaterialIcons = new CompelExtension();
@ -15,22 +15,32 @@ MaterialIcons.builderElements = {
* @returns {Component} * @returns {Component}
*/ */
iconMIO: function (icon, attr = {}) { iconMIO: function (icon, attr = {}) {
let styleClass = "material-icons";
Page.registerStyling(
"." + styleClass,
{
"user-select": "none",
"-ms-user-select": "none",
"-webkit-user-select": "none",
}
);
return builder.genTag('i', attr) return builder.genTag('i', attr)
.addStyleClass("material-icons") .addStyleClass(styleClass)
//.addStyleClass("compel-"+styleClass)
.text(icon); .text(icon);
}, },
/** /**
* *
* @param {MATERIAL_DESIGN_ICONS} icon * @param {ICONS} icon
* @param {Function} onClick * @param {Function} onClick
* @param {string} text * @param {string} text
* @param {Map<string,string>} attr * @param {Map<string,string>} attr
* @returns {Component} * @returns {Component}
*/ */
iconButton: function (icon, onclick, text, attr = {}) { iconButton: function (icon, onclick, text, attr = {}) {
let clickableIcon = builder.iconMIO(icon, attr) let clickableIcon = builder.extensions.iconMIO(icon, attr)
.addEventListener(CommonEvents.ONCLICK, onclick); .addEventListener("click", onclick);
return builder.column() return builder.column()
.alignment(Alignment.CENTER) .alignment(Alignment.CENTER)
.arrangement(Arrangement.CENTER) .arrangement(Arrangement.CENTER)
@ -50,7 +60,8 @@ MaterialIcons.stylings = {
"@font-face": new Modifier() "@font-face": new Modifier()
.setStyleRule("font-family", "'Material Icons'") .setStyleRule("font-family", "'Material Icons'")
.setStyleRule("font-weight", "400") .setStyleRule("font-weight", "400")
.setStyleRule("src", `url(../../extensions/jpclwe-materialIcons/20250220-materialicons.woff2) format('woff2')`) //.setStyleRule("src", `url(../../extensions/jpclwe-materialIcons/20250220-materialicons.woff2) format('woff2')`)
.setStyleRule("src", `url(file:///C:/_dev_space/repos/jpc-like-websites/extensions/jpclwe-materialIcons/20250220-materialicons.woff2) format('woff2')`)
, ,
".material-icons": new Modifier() ".material-icons": new Modifier()
.setStyleRule("font-family", "'Material Icons'") .setStyleRule("font-family", "'Material Icons'")

21
package.json

@ -0,0 +1,21 @@
{
"name": "jpclwe-materialicons",
"version": "1.0.0",
"description": "Module adding material icons to the jpc-like-websites components",
"keywords": [
"jpc",
"jpclwe",
"extension"
],
"repository": {
"type": "git",
"url": "http://git.labos.goip.de/chris/jpclwe-materialIcons.git"
},
"license": "ISC",
"author": "cm",
"type": "commonjs",
"main": "icons.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
Loading…
Cancel
Save