Created
November 9, 2024 00:28
-
-
Save prince-neres/3701044fba8a712e70cb08e2977b3877 to your computer and use it in GitHub Desktop.
Useful macro to use in fragments and templates
This file contains hidden or 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
| <#macro button configuration> | |
| <div class="po-custom-btn"> | |
| <#if configuration.type=="action"> | |
| <button | |
| class="btn btn-${configuration.buttonSize} btn-${configuration.buttonType}" | |
| data-lfr-editable-id="action" | |
| data-lfr-editable-type="action" | |
| > | |
| Go Somewhere | |
| </button> | |
| <#else> | |
| <div class="component-button text-break"> | |
| <a | |
| class="btn btn-${configuration.buttonSize} btn-${configuration.buttonType}" | |
| data-lfr-editable-id="link" | |
| data-lfr-editable-type="link" | |
| href="" | |
| id="fragment-${fragmentEntryLinkNamespace}-link" | |
| > | |
| Go Somewhere | |
| </a> | |
| </div> | |
| </#if> | |
| </div> | |
| <#-- TODO: move to globalCSS --> | |
| <style> | |
| .po-custom-btn .btn { | |
| border-width: ${configuration.borderWidth} !important; | |
| } | |
| <#if configuration.clayIcon != ""> | |
| .po-custom-btn .btn::after { | |
| content: ''; | |
| margin-left: .5rem; | |
| height: ${configuration.iconSize}; | |
| width: ${configuration.iconSize}; | |
| display: inline-block; | |
| background-color: ${configuration.iconColor}; | |
| mask-image: url(${themeDisplay.getPathThemeImages()}/clay/${configuration.clayIcon}.svg); | |
| mask-size: cover; | |
| mask-repeat: no-repeat; | |
| } | |
| </#if> | |
| </style> | |
| </#macro> |
This file contains hidden or 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
| [#if request.getParameterNames()??] | |
| [#assign | |
| groupId = request.getParameterNames()?sequence?seq_contains("groupId")?string(paramUtil.getString(request, "groupId"), scopeGroupId) | |
| /] | |
| [#assign templatePath] | |
| _TEMPLATE_CONTEXT_/${themeDisplay.getCompanyId()}/${groupId}/${serviceLocator | |
| .findService("com.liferay.portal.kernel.service.ClassNameLocalService") | |
| .getClassNameId("com.liferay.portal.kernel.theme.NavItem")} | |
| [/#assign] | |
| [#import "${templatePath}/PORTAL-ONE-MACROS" as po/] | |
| [@po.button configuration /] | |
| [/#if] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment