Skip to content

Commit

Permalink
Add Text Widget, Improve modal style
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Dec 4, 2023
1 parent 83b171e commit d18f5d9
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 32 deletions.
2 changes: 1 addition & 1 deletion assets/vendor/manager/dist/index.css

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions assets/vendor/manager/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/vendor/manager/src/assets/_modal.scss
Expand Up @@ -5,7 +5,7 @@
}
.nav-tabs {
--bs-nav-link-padding-y: 1rem;
background: transparent linear-gradient(to right, var(--as-violet-bg), #171124) repeat scroll 0 0 !important;
background-color: var(--as-violet-bg);
font-size: 1rem;
.nav-link:not(.active) {
color: white;
Expand Down
2 changes: 1 addition & 1 deletion assets/vendor/manager/src/components/Sidebar.vue
Expand Up @@ -18,7 +18,7 @@ const props = defineProps({
<a :href="`#`+group.name" class="as-page-link" @click.prevent="$emit('sidebarActive', group.name)">
<strong class="as-links-heading d-flex w-100 align-items-center fw-semibold">
<i :class="group.icon" class="me-2"></i>
{{ group.label }}
<span class="d-flex align-items-center" v-html="group.label"></span>
</strong>
</a>
<ul class="list-unstyled fw-normal pb-2 small" v-if="Object.keys(group.childs).length > 0">
Expand Down
4 changes: 2 additions & 2 deletions framework/elements/default.xml
Expand Up @@ -77,8 +77,8 @@
<field ngShow="[custom_colors]==1" name="link_hover_color" type="astroidcolor" label="TPL_ASTROID_LINK_HOVER_COLOR_LABEL" />

<field name="spacing_settings" type="astroidheading" title="ASTROID_ELEMENT_HEAD_SPACING_LABEL" />
<field name="margin" type="astroidspacing" label="Margin" />
<field name="padding" type="astroidspacing" label="Padding" />
<field name="margin" type="astroidspacing" label="ASTROID_WIDGET_MARGIN_LABEL" />
<field name="padding" type="astroidspacing" label="ASTROID_WIDGET_PADDING_LABEL" />
</fieldset>
<fieldset name="responsive-settings" label="ASTROID_ELEMENT_HEAD_RESPONSIVE_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field name="device_settings" type="astroidheading" title="ASTROID_ELEMENT_HEAD_DEVICE_VISIBILITY_LABEL" />
Expand Down
15 changes: 12 additions & 3 deletions framework/elements/heading/heading.php
Expand Up @@ -8,16 +8,25 @@
* DO NOT MODIFY THIS FILE DIRECTLY AS IT WILL BE OVERWRITTEN IN THE NEXT UPDATE
* You can easily override all files under /astroid/ folder.
* Just copy the file to JROOT/templates/YOUR_ASTROID_TEMPLATE/astroid/elements/module_position/module_position.php folder to create and override
* See https://docs.joomdev.com/article/override-core-layouts/ for documentation
*/

// No direct access.
defined('_JEXEC') or die;
extract($displayData);
$title = $params->get('title', '');
$html_element = $params->get('html_element', 'h2');
$font_style = $params->get('font_style');
$font_style = $params->get('font_style', null);
$use_link = $params->get('use_link', 0);
$link = $params->get('link', '');
if (!empty($title)) {
if ($use_link) {
echo '<a href="'.$link.'" title="'.$title.'">';
}
echo '<'.$html_element.' class="heading">'. $title . '</'.$html_element.'>';
if ($use_link) {
echo '</a>';
}
}
Astroid\Helper\Style::renderTypography('#'.$element->id.' > .heading', $font_style);
if (!empty($font_style)) {
Astroid\Helper\Style::renderTypography('#'.$element->id.' .heading', $font_style);
}
1 change: 1 addition & 0 deletions framework/elements/heading/heading.xml
Expand Up @@ -9,6 +9,7 @@
<fieldset name="general-settings" label="TPL_ASTROID_GENERAL_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field type="astroidgroup" name="widget_styles" title="ASTROID_WIDGET_STYLES_LABEL"/>
<field astroidgroup="general" description="ASTROID_WIDGET_HEADING_USE_LINK_DESC" name="use_link" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_WIDGET_HEADING_USE_LINK_LABEL"/>
<field astroidgroup="general" ngShow="[use_link]==1" type="astroidtext" label="ASTROID_WIDGET_HEADING_LINK_LABEL" description="ASTROID_WIDGET_HEADING_LINK_DESC" name="link" hint="https://astroidframe.work/"/>
<field astroidgroup="widget_styles" name="html_element" type="astroidlist" label="ASTROID_WIDGET_HTML_ELEMENT_LABEL" default="h2">
<option value="h1">h1</option>
<option value="h2">h2</option>
Expand Down
45 changes: 45 additions & 0 deletions framework/elements/text/text.php
@@ -0,0 +1,45 @@
<?php

/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
* DO NOT MODIFY THIS FILE DIRECTLY AS IT WILL BE OVERWRITTEN IN THE NEXT UPDATE
* You can easily override all files under /astroid/ folder.
* Just copy the file to JROOT/templates/YOUR_ASTROID_TEMPLATE/astroid/elements/module_position/module_position.php folder to create and override
*/

// No direct access.
defined('_JEXEC') or die;
use Astroid\Helper\Style;
extract($displayData);
$title = $params->get('heading', '');
$html_element = $params->get('html_element', 'h2');
$font_style = $params->get('font_style', null);
$heading_margin = $params->get('heading_margin', '');
$content = $params->get('content', '');
$content_font_style= $params->get('content_font_style', null);

if (!empty($title)) {
echo '<'.$html_element.' class="astroid-content-heading">'. $title . '</'.$html_element.'>';
}
if (!empty($content)) {
echo '<div class="astroid-content-text">'. $content . '</div>';
}

if (!empty($font_style)) {
Style::renderTypography('#'.$element->id.' > .astroid-content-heading', $font_style);
}
if (!empty($heading_margin)) {
$heading_style = new Style('#'.$element->id.' > .astroid-content-heading');
$margin = \json_decode($heading_margin, false);
foreach ($margin as $device => $props) {
$heading_style->addStyle(Style::spacingValue($props, "margin"), $device);
}
$heading_style->render();
}

if (!empty($content_font_style)) {
Style::renderTypography('#'.$element->id.' > .astroid-content-text', $content_font_style);
}
29 changes: 29 additions & 0 deletions framework/elements/text/text.xml
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<element>
<title>ASTROID_WIDGET_TEXT_LABEL</title>
<description>ASTROID_WIDGET_TEXT_DESC</description>
<icon>fa-solid fa-font</icon>
<category>Widgets</category>
<form>
<fields>
<fieldset name="general-settings" label="TPL_ASTROID_GENERAL_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field type="astroidgroup" name="content_options" title="ASTROID_WIDGET_CONTENT_OPTIONS_LABEL"/>
<field astroidgroup="general" type="astroidtext" label="ASTROID_WIDGET_HEADING_LABEL" description="ASTROID_WIDGET_HEADING_CONTENT_DESC" name="heading"/>
<field astroidgroup="general" ngShow="[heading]!==''" name="html_element" type="astroidlist" label="ASTROID_WIDGET_HTML_ELEMENT_LABEL" default="h2">
<option value="h1">h1</option>
<option value="h2">h2</option>
<option value="h3">h3</option>
<option value="h4">h4</option>
<option value="h5">h5</option>
<option value="h6">h6</option>
<option value="div">div</option>
</field>
<field astroidgroup="general" ngShow="[heading]!==''" name="font_style" label="ASTROID_WIDGET_FONT_STYLES_LABEL" type="astroidtypography" columns="1" preview="false"/>
<field astroidgroup="general" ngShow="[heading]!==''" name="heading_margin" type="astroidspacing" label="ASTROID_WIDGET_MARGIN_LABEL" />

<field astroidgroup="content_options" code="html" name="content" type="astroidtextarea" label="ASTROID_WIDGET_CONTENT_LABEL"/>
<field astroidgroup="content_options" ngShow="[content]!==''" name="content_font_style" label="ASTROID_WIDGET_FONT_STYLES_LABEL" type="astroidtypography" columns="1" preview="false"/>
</fieldset>
</fields>
</form>
</element>
6 changes: 1 addition & 5 deletions framework/library/astroid/Element/BaseElement.php
Expand Up @@ -45,11 +45,7 @@ public function __construct($data, $devices)
$this->params->loadArray($params);
}

if (!in_array($this->type, ['section', 'row', 'column', 'element', 'component', 'message', 'banner', 'module_position'])) {
$this->addClass('astroid-' . Helper::slugify($this->type) .'-widget');
} else {
$this->addClass('astroid-' . Helper::slugify($this->type));
}
$this->addClass('astroid-' . Helper::slugify($this->type));

$this->_id();
$this->style = new Style('#' . $this->getAttribute('id'));
Expand Down
19 changes: 16 additions & 3 deletions language/en-GB/en-GB.astroid.ini
Expand Up @@ -1089,10 +1089,23 @@ TPL_ASTROID_MINIFYJS_EXCLUDES_LABEL="Exclude JS Files"
TPL_ASTROID_MINIFYJS_EXCLUDES_DESC="Add comma separated filesnames to exclude files from JS minification. You can add filename directly or use available filename patterns: <br/> <code>*.min.js</code><br/> <code>jquery.*</code><br/> <code>*bootstrap*</code>"

; Widgets
ASTROID_WIDGET_HEADING_LABEL="Heading"
ASTROID_WIDGET_HEADING_DESC="Define different styles for headings"
ASTROID_WIDGET_STYLES_LABEL="Widget Styles"
ASTROID_WIDGET_HTML_ELEMENT_LABEL="HTML Element"
ASTROID_WIDGET_FONT_STYLES_LABEL="Font Styles"
ASTROID_WIDGET_CONTENT_OPTIONS_LABEL="Content Options"
ASTROID_WIDGET_MARGIN_LABEL="Margin"
ASTROID_WIDGET_PADDING_LABEL="Padding"
ASTROID_WIDGET_CONTENT_LABEL="Content"

; Heading Widget
ASTROID_WIDGET_HEADING_LABEL="Heading"
ASTROID_WIDGET_HEADING_DESC="Define different styles for headings"
ASTROID_WIDGET_HEADING_USE_LINK_LABEL="Use Link"
ASTROID_WIDGET_HEADING_USE_LINK_DESC="Add link to your heading"
ASTROID_WIDGET_HEADING_USE_LINK_DESC="Add link to your heading"
ASTROID_WIDGET_HEADING_LINK_LABEL="Link"
ASTROID_WIDGET_HEADING_LINK_DESC="Add your link of heading"

; Text Widget
ASTROID_WIDGET_TEXT_LABEL="Text"
ASTROID_WIDGET_TEXT_DESC="Display Text Content in different styles"
ASTROID_WIDGET_HEADING_CONTENT_DESC="Heading of text content"

0 comments on commit d18f5d9

Please sign in to comment.