From: soufiane Date: Thu, 24 Apr 2025 16:30:44 +0000 (+0200) Subject: wip #7254 modif compilation, configuration laravel mix, menu responsive, init widget... X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=92933ec9e45ad7b9efda27755b16cb3b22af4cd0;p=miranui.git wip #7254 modif compilation, configuration laravel mix, menu responsive, init widget banner --- diff --git a/wp-content/mu-plugins/cube/Widgets/BannerText.php b/wp-content/mu-plugins/cube/Widgets/BannerText.php new file mode 100644 index 0000000..b2000c5 --- /dev/null +++ b/wp-content/mu-plugins/cube/Widgets/BannerText.php @@ -0,0 +1,141 @@ +start_controls_section( + $id, + [ + 'label' => esc_html__($name, 'cube'), + 'tab' => Controls_Manager::TAB_CONTENT, + ] + ); + } + protected function controls() { + $this->add_control( + 'title', + [ + 'label' => __( 'Title', 'elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'placeholder' => __( 'Enter your title', 'elementor' ), + 'default' => 'Lorem ipsum', + ] + ); + + $this->add_control( + 'image', + [ + 'label' => esc_html__( 'Choose Image', 'textdomain' ), + 'type' => Controls_Manager::MEDIA, + 'default' => [ + 'url' => \Elementor\Utils::get_placeholder_image_src(), + ], + ] + ); + } + + protected function end() { + $this->end_controls_section(); + } + + protected function register_controls() { + self::start('content_section', 'Content'); + $this->controls(); + self::end(); + } + + /** + * Render list widget output on the frontend. + * + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + + $size = $this->get_settings('text_size') ? $this->get_settings('text_size') : 'large'; + + $size_classes = [ + 'xxlarge' => 'text-xl', + 'xlarge' => 'text-lg-1', + 'large' => 'text-lg', + ]; + + // CSS Classes for elements + $this->add_render_attribute('title', 'class', ["text-block-title font-bold $size_classes[$size]"]); + $this->add_render_attribute('subtitle', 'class', ["text-block-subtitle font-bold text-md"]); + $this->add_render_attribute('body', 'class', ['text-block-body']); + + $settings = $this->get_controls_settings(); + $attributes = $this->get_render_attributes(); + + // Rendered content + echo view("widgets/banner", compact("settings", "attributes")); + } + + protected function backboneTemplate(){ ?> + <# + size_classes = { + 'xlarge': 'text-xl', + 'large': 'text-lg', + }; + + view.addRenderAttribute( + 'title', + { + 'class': [ 'text-block-title font-bold text-xl', size_classes[settings.text_size] ] + } + ); + view.addRenderAttribute( 'subtitle', 'class', ['text-block-subtitle font-bold text-md']); + view.addRenderAttribute( 'body', 'class', ['text-block-body']); + + view.addInlineEditingAttributes( 'title', 'none' ); + view.addInlineEditingAttributes( 'subtitle', 'none' ); + view.addInlineEditingAttributes( 'body', 'none' ); + #> +
+ + <# if ('' !== settings.title) { #> + <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ settings.title }}} + <# } #> + + <# if ('' !== settings.subtitle) { #> + <{{{ settings.subtitle_tag }}} {{{ view.getRenderAttributeString( 'subtitle' ) }}}>{{{ settings.subtitle }}} + <# } #> + + <# if ('' !== settings.body) { #> +
{{{ settings.body }}}
+ <# } #> + +
+ { + /** + * Application entrypoints + * @see {@link https://bud.js.org/docs/bud.entry/} + */ + app + .entry({ + app: ['@styles/app','@scripts/app'], + //editor: ['@scripts/editor', '@styles/editor'] + }) + + .tap(bud => bud.postcss.setPluginOptions('env', { + //preserve: false, + features: { + 'custom-properties': false, // Don't make css var fallback values + }, + })) + .provide({ + jquery: ["jQuery", "$"], + }) + /** + * Directory contents to be included in the compilation + * @see {@link https://bud.js.org/docs/bud.assets/} + */ + .assets(['images']) + + /** + * Matched files trigger a page reload when modified + * @see {@link https://bud.js.org/docs/bud.watch/} + */ + .watch(['resources/views', 'app']) + + + /** + * Proxy origin (`WP_HOME`) + * @see {@link https://bud.js.org/docs/bud.proxy/} + */ + .proxy('http://example.test') + + /** + * Development origin + * @see {@link https://bud.js.org/docs/bud.serve/} + */ + .serve('http://localhost:3000') + + /** + * URI of the `public` directory + * @see {@link https://bud.js.org/docs/bud.setPublicPath/} + */ + .setPublicPath('/wp-content/themes/miranui_new/public/') + +}; diff --git a/wp-content/themes/miranui_new/resources/css/common.scss b/wp-content/themes/miranui_new/resources/css/common.scss new file mode 100644 index 0000000..7edbb8c --- /dev/null +++ b/wp-content/themes/miranui_new/resources/css/common.scss @@ -0,0 +1,41 @@ +.mira { + &-container { + max-width: 1460px; + width: 100%; + margin: 0 auto; + padding: 0 16px; + @include above($mdScreen) { + padding: 0 32px; + } + } + + &-label { + padding-left: 20px; + position: relative; + font-size: 18px; + &:before { + content: ""; + width: 12px; + height: 12px; + background-color: $clearRed; + border-radius: 24px; + } + } + + &-semibold { + font-weight: 600; + } + +} + +.hide-on-desktop { + @include above($mdScreen) { + display: none !important; + } +} + +.hide-on-mobile { + @include below($mdScreen) { + display: none !important; + } +} diff --git a/wp-content/themes/miranui_new/resources/css/font.scss b/wp-content/themes/miranui_new/resources/css/font.scss new file mode 100644 index 0000000..89cf046 --- /dev/null +++ b/wp-content/themes/miranui_new/resources/css/font.scss @@ -0,0 +1,17 @@ +@font-face { + font-family: 'Poppins'; + src: url('../fonts/Poppins-SemiBold.woff2') format('woff2'), + url('../fonts/Poppins-SemiBold.woff') format('woff'); + font-weight: 600; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Poppins'; + src: url('../fonts/Poppins-Regular.woff2') format('woff2'), + url('../fonts/Poppins-Regular.woff') format('woff'); + font-weight: normal; + font-style: normal; + font-display: swap; +} diff --git a/wp-content/themes/miranui_new/resources/css/header.scss b/wp-content/themes/miranui_new/resources/css/header.scss new file mode 100644 index 0000000..301ab62 --- /dev/null +++ b/wp-content/themes/miranui_new/resources/css/header.scss @@ -0,0 +1,111 @@ +.mira { + &-header { + padding: 24px 0; + transition: all .3s; + + .clear & { + @include bg($navBlue) + } + + .mira-container { + @include flex(space-between, center); + position: relative; + } + + @include above(992px) { + padding: 52px 0; + } + + &-btn { + @include bg($clearRed); + @include r(20px); + @include flex(center,center); + color: #fff; + height: 40px; + width: max-content; + padding: 0 24px; + border: 0; + &:hover { + @include bg($darkRed); + } + } + + #menu-item-20 { + @extend .hide-on-desktop; + } + + #toggleMenu { + display: flex; + flex-direction: column; + gap: 2px; + width: 40px; + padding: 0; + &:hover, + &.active { + .bar:first-child { + transform: rotate(45deg); + top: 20px; + } + .bar:last-child { + transform: rotate(-45deg); + bottom: 18px; + } + } + .bar { + width: 40%; + height: 2px; + @include bg(white); + position: absolute; + transition: .3s all; + &:first-child { + top: 17px; + } + &:last-child { + bottom: 15px; + } + } + } + } + + &-logo, + &-header-btn { + position: relative; + z-index: 1; + } + + &-nav { + @include flex(center,center); + @include bg($navBlue); + flex-direction: column; + gap: 32px; + position: absolute; + width: 100vw; + height: 100vh; + top: -100vh; + left: 0; + transition: top .3s; + &.active { + top: 0; + } + @include above($mdScreen) { + @include bg(transparent); + @include absoluteCenter; + top: 50%; + left: 50%; + width: auto; + height: auto; + } + + ul { + @include flex(center, center); + flex-direction: column; + gap: 32px; + @include above($mdScreen) { + flex-direction: row; + } + a { + color: #fff; + } + } + } +} diff --git a/wp-content/themes/miranui_new/resources/css/mixins.scss b/wp-content/themes/miranui_new/resources/css/mixins.scss new file mode 100644 index 0000000..6e33e8e --- /dev/null +++ b/wp-content/themes/miranui_new/resources/css/mixins.scss @@ -0,0 +1,32 @@ +@mixin absoluteCenter() { + top: 50%; + left: 50%; + transform: translate(-50%,-50%); +} + +@mixin flex($justifyContent: 'initial',$alignItems: 'initial',$order:'initial') { + display: flex; + justify-content: $justifyContent; + align-items: $alignItems; + order: $order; +} + +@mixin r($r) { + border-radius: $r; +} + +@mixin above($value) { + @media (min-width: $value) { + @content; + } +} + +@mixin below($value) { + @media (max-width: $value) { + @content; + } +} + +@mixin bg($var) { + background-color: $var; +} diff --git a/wp-content/themes/miranui_new/resources/css/variables.scss b/wp-content/themes/miranui_new/resources/css/variables.scss index d92db6b..25fd623 100644 --- a/wp-content/themes/miranui_new/resources/css/variables.scss +++ b/wp-content/themes/miranui_new/resources/css/variables.scss @@ -1,6 +1,12 @@ -$actionRed: #B34049; -$logoRed: #D75B65; +$clearRed: #D75B65; +$darkRed: #B34049; $clearBlue: #6F7BB6; $middleBlue: #404F8E; $navBlue: #22335C; $darkblue: #15203F; + +$mdScreen: 992px; +$lgScreen: 1280px; + +$fsH1: clamp(3rem, 1.7249rem + 5.4406vw, 7.4375rem); +$fsH2: clamp(2.4375rem, 2.0424rem + 1.6858vw, 3.8125rem); diff --git a/wp-content/themes/miranui_new/resources/fonts/Poppins-Regular.woff b/wp-content/themes/miranui_new/resources/fonts/Poppins-Regular.woff new file mode 100644 index 0000000..4d078d0 Binary files /dev/null and b/wp-content/themes/miranui_new/resources/fonts/Poppins-Regular.woff differ diff --git a/wp-content/themes/miranui_new/resources/fonts/Poppins-Regular.woff2 b/wp-content/themes/miranui_new/resources/fonts/Poppins-Regular.woff2 new file mode 100644 index 0000000..9743d2c Binary files /dev/null and b/wp-content/themes/miranui_new/resources/fonts/Poppins-Regular.woff2 differ diff --git a/wp-content/themes/miranui_new/resources/fonts/Poppins-SemiBold.woff b/wp-content/themes/miranui_new/resources/fonts/Poppins-SemiBold.woff new file mode 100644 index 0000000..3953d50 Binary files /dev/null and b/wp-content/themes/miranui_new/resources/fonts/Poppins-SemiBold.woff differ diff --git a/wp-content/themes/miranui_new/resources/fonts/Poppins-SemiBold.woff2 b/wp-content/themes/miranui_new/resources/fonts/Poppins-SemiBold.woff2 new file mode 100644 index 0000000..4d1e972 Binary files /dev/null and b/wp-content/themes/miranui_new/resources/fonts/Poppins-SemiBold.woff2 differ diff --git a/wp-content/themes/miranui_new/resources/images/linkedin.svg b/wp-content/themes/miranui_new/resources/images/linkedin.svg new file mode 100644 index 0000000..0e04cc6 --- /dev/null +++ b/wp-content/themes/miranui_new/resources/images/linkedin.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/wp-content/themes/miranui_new/resources/images/logo_miranui.svg b/wp-content/themes/miranui_new/resources/images/logo_miranui.svg new file mode 100644 index 0000000..eb6d070 --- /dev/null +++ b/wp-content/themes/miranui_new/resources/images/logo_miranui.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wp-content/themes/miranui_new/resources/views/widgets/banner.blade.php b/wp-content/themes/miranui_new/resources/views/widgets/banner.blade.php new file mode 100644 index 0000000..c4672f3 --- /dev/null +++ b/wp-content/themes/miranui_new/resources/views/widgets/banner.blade.php @@ -0,0 +1,12 @@ +@php + $largeImg = wp_get_attachment_image_url($settings['image']['id'],'large') +@endphp + +
+ @if($settings['image']['url']) + + @endif + @if($settings['title']) +

{{ $settings['title'] }}

+ @endif +
diff --git a/wp-content/themes/miranui_new/webpack.mix.js b/wp-content/themes/miranui_new/webpack.mix.js new file mode 100644 index 0000000..a3f578d --- /dev/null +++ b/wp-content/themes/miranui_new/webpack.mix.js @@ -0,0 +1,46 @@ +let mix = require('laravel-mix'); + +// Source path helper +const fs = require('fs'); +const path = require('path'); + +const themePublicUrl = '/wp-content/themes/miranui_new/public'; + +mix + .setPublicPath('public') + .setResourceRoot(`/wp-content/themes/miranui_new/public`) + .webpackConfig({ + output: { publicPath: `/wp-content/themes/miranui_new/public` } + }); + +const publicPath = path => `${mix.config.publicPath}/${path}`; + + +mix.js('resources/js/app.js', 'public').sass('resources/css/app.scss', 'public').options({ + processCssUrls: false +}).version(); + +// Assets +mix.copyDirectory('resources/images', `public/images`) + .copyDirectory('resources/fonts', `public/fonts`); + +mix.then(() => { + const manifestPath = path.resolve(__dirname, 'public/mix-manifest.json'); + + if (!fs.existsSync(manifestPath)) { + console.error('mix-manifest.json not found'); + return; + } + + const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8')); + const updatedManifest = {}; + + for (const key in manifest) { + updatedManifest[key] = themePublicUrl + manifest[key]; + } + + fs.writeFileSync( + manifestPath, + JSON.stringify(updatedManifest, null, 2) + ); +});