Skip to content

Commit

Permalink
Merge pull request #65 from eoxia-amandine/add_block_liste_categories
Browse files Browse the repository at this point in the history
#61 [Block] add: List course category block
  • Loading branch information
eoxia-amandine authored Sep 4, 2024
2 parents 976a797 + 5a0539d commit 872f87e
Show file tree
Hide file tree
Showing 10 changed files with 458 additions and 38 deletions.
80 changes: 44 additions & 36 deletions block-templates/archive-course.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|50"}}},"layout":{"inherit":false,"contentSize":"1100px","type":"constrained"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50)"><!-- wp:query-title {"type":"archive","showPrefix":false} /--></div>
<!-- wp:group {"backgroundColor":"light-grey","layout":{"type":"default"}} -->
<div class="wp-block-group has-light-grey-background-color has-background"><!-- wp:group {"layout":{"type":"constrained","contentSize":"1200px"}} -->
<div class="wp-block-group"><!-- wp:query-title {"type":"archive","showPrefix":false} /-->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"25%"} -->
<div class="wp-block-column" style="flex-basis:25%"><!-- wp:beflex/list-course-category {"name":"beflex/list-course-category","mode":"preview"} /--></div>
<!-- /wp:column -->

<!-- wp:column {"width":"75%"} -->
<div class="wp-block-column" style="flex-basis:75%"><!-- wp:query {"queryId":28,"query":{"perPage":3,"pages":0,"offset":0,"postType":"course","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"className":"query-course wp-block-sensei-lms-course-list"} -->
<div class="wp-block-query query-course wp-block-sensei-lms-course-list"><!-- wp:post-template {"layout":{"type":"grid","columnCount":3}} -->
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"0","bottom":"0","left":"0","right":"0"}},"border":{"radius":"6px"}},"backgroundColor":"white"} -->
<div class="wp-block-group alignwide has-white-background-color has-background" style="border-radius:6px;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0"><!-- wp:post-featured-image {"isLink":true,"align":"wide","style":{"border":{"radius":{"topLeft":"6px","topRight":"6px"}}}} /-->

<!-- wp:group {"style":{"spacing":{"padding":{"top":"0em","right":"1em","bottom":"0em","left":"1em"}}}} -->
<div class="wp-block-group" style="padding-top:0em;padding-right:1em;padding-bottom:0em;padding-left:1em"><!-- wp:sensei-lms/course-categories {"options":{}} -->
<div class="wp-block-sensei-lms-course-categories"></div>
<!-- /wp:sensei-lms/course-categories -->

<!-- wp:post-title {"level":3,"isLink":true,"style":{"typography":{"fontSize":"18px"},"elements":{"link":{"color":{"text":"var:preset|color|black"}}},"spacing":{"margin":{"top":"0.2em","right":"0em","bottom":"0em","left":"0em"}}}} /--></div>
<!-- /wp:group -->

<!-- wp:group {"style":{"spacing":{"padding":{"right":"1em","left":"1em"}}},"layout":{"type":"flex","allowOrientation":false}} -->
<div class="wp-block-group" style="padding-right:1em;padding-left:1em"><!-- wp:beflex/course-lesson {"name":"beflex/course-lesson","mode":"preview"} /-->

<!-- wp:beflex/course-time {"name":"beflex/course-time","mode":"preview"} /--></div>
<!-- /wp:group -->

<!-- wp:sensei-lms/course-progress {"customBarColor":"#1be184","height":10,"borderRadius":0} /--></div>
<!-- /wp:group -->
<!-- /wp:post-template -->

<!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"center"}} -->
<!-- wp:query-pagination-previous {"label":"","fontSize":"small"} /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next {"label":" ","fontSize":"small"} /-->
<!-- /wp:query-pagination --></div>
<!-- /wp:query --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|50"}}},"layout":{"type":"constrained","contentSize":"1100px"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50)"><!-- wp:query {"queryId":28,"query":{"perPage":3,"pages":0,"offset":0,"postType":"course","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"className":"query-course wp-block-sensei-lms-course-list"} -->
<div class="wp-block-query query-course wp-block-sensei-lms-course-list"><!-- wp:post-template {"layout":{"type":"grid","columnCount":3}} -->
<!-- wp:group {"align":"wide","style":{"border":{"width":"1px","style":"solid","color":"#c5c5c5"}}} -->
<div class="wp-block-group alignwide has-border-color" style="border-color:#c5c5c5;border-style:solid;border-width:1px"><!-- wp:post-featured-image {"isLink":true,"align":"wide"} /-->

<!-- wp:group {"style":{"spacing":{"padding":{"top":"0em","right":"1em","bottom":"0em","left":"1em"}}}} -->
<div class="wp-block-group" style="padding-top:0em;padding-right:1em;padding-bottom:0em;padding-left:1em"><!-- wp:sensei-lms/course-categories {"options":[]} -->
<div class="wp-block-sensei-lms-course-categories"></div>
<!-- /wp:sensei-lms/course-categories -->

<!-- wp:post-title {"level":3,"isLink":true,"style":{"typography":{"fontSize":"18px"},"elements":{"link":{"color":{"text":"var:preset|color|black"}}},"spacing":{"margin":{"top":"0.2em","right":"0em","bottom":"0em","left":"0em"}}}} /--></div>
<!-- /wp:group -->

<!-- wp:group {"style":{"spacing":{"padding":{"right":"1em","left":"1em"}}},"layout":{"type":"flex","allowOrientation":false}} -->
<div class="wp-block-group" style="padding-right:1em;padding-left:1em"><!-- wp:beflex/course-lesson {"name":"beflex/course-lesson","data":[],"mode":"preview"} /-->

<!-- wp:beflex/course-time {"name":"beflex/course-time","data":[],"mode":"preview"} /--></div>
<!-- /wp:group -->

<!-- wp:sensei-lms/course-progress {"customBarColor":"#1be184","height":10,"borderRadius":0} /--></div>
<!-- /wp:group -->
<!-- /wp:post-template -->

<!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"center"}} -->
<!-- wp:query-pagination-previous {"label":"","fontSize":"small"} /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next {"label":" ","fontSize":"small"} /-->
<!-- /wp:query-pagination --></div>
<!-- /wp:query --></div>
<!-- /wp:group -->
4 changes: 3 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ var scss_paths = [
'inc/blocks/bfs-course-tax/assets/scss/**/*.scss',
'inc/blocks/bfs-course-lesson/assets/scss/**/*.scss',
'inc/blocks/bfs-course-time/assets/scss/**/*.scss',
'inc/blocks/bfs-login/assets/scss/**/*.scss'
'inc/blocks/bfs-login/assets/scss/**/*.scss',
'inc/blocks/bfs-list-course-category/assets/scss/**/*.scss'

];

/** SCSS */
Expand Down
1 change: 1 addition & 0 deletions inc/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require get_template_directory() . '/inc/blocks/bfs-course-lesson/bfs-course-lesson.php';
require get_template_directory() . '/inc/blocks/bfs-course-time/bfs-course-time.php';
require get_template_directory() . '/inc/blocks/bfs-login/bfs-login.php';
require get_template_directory() . '/inc/blocks/bfs-list-course-category/bfs-list-course-category.php';
}

/**
Expand Down
48 changes: 48 additions & 0 deletions inc/blocks/bfs-list-course-category/assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Style CSS de bfs-list-course-category
*/
.bfs-list-course-category {
/** Level 0 */
/** Level 1+ */
/** Level 2+ */
/** Active */
}
.bfs-list-course-category > .bfs-list-course-category__nav {
margin-bottom: 1em;
background: #fff;
border-radius: 6px;
-webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05);
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05);
padding: 1.5em 0;
}
.bfs-list-course-category > .bfs-list-course-category__nav > .bfs-list-course-category__nav-link {
display: block;
text-transform: uppercase;
font-size: var(--wp--preset--font-size--small);
font-weight: 700;
margin-bottom: 1em;
}
.bfs-list-course-category > .bfs-list-course-category__nav .bfs-list-course-category__nav-link {
padding: 0 1.5em;
}
.bfs-list-course-category > .bfs-list-course-category__nav .bfs-list-course-category__nav .bfs-list-course-category__nav-link {
display: block;
color: rgba(0, 0, 0, 0.8);
font-size: var(--wp--preset--font-size--small);
font-weight: 600;
}
.bfs-list-course-category .bfs-list-course-category__nav.level-1 .bfs-list-course-category__nav {
margin-left: 1em;
}
.bfs-list-course-category .bfs-list-course-category__nav.level-1 .bfs-list-course-category__nav .bfs-list-course-category__nav-link {
display: block;
color: rgba(0, 0, 0, 0.4);
}
.bfs-list-course-category .bfs-list-course-category__nav.level-0 > .bfs-list-course-category__nav-link.current, .bfs-list-course-category .bfs-list-course-category__nav.level-1 > .bfs-list-course-category__nav-link.current {
border-left: 4px solid var(--wp--preset--color--primary);
margin-left: -2px;
padding-left: calc(1.5em - 2px);
}
.bfs-list-course-category .bfs-list-course-category__nav.level-1 .bfs-list-course-category__nav .bfs-list-course-category__nav-link.current {
color: var(--wp--preset--color--primary);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions inc/blocks/bfs-list-course-category/assets/json/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "beflex/list-course-category",
"title": "BFS List Course Category",
"description": "Display a navigation menu with all courses categories",
"style": [ "block-bfs-list-course-category-style" ],
"viewScript": [],
"category": "beflex",
"icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d=\"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z\"/></svg>",
"apiVersion": 2,
"textdomain": "beflex",
"keywords": [
"beflex",
"bfs",
"list-course-category"
],
"supports": {
},
"acf": {
"mode": "auto",
"renderTemplate": "../../view.php"
}
}
60 changes: 60 additions & 0 deletions inc/blocks/bfs-list-course-category/assets/scss/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Style CSS de bfs-list-course-category
*/

.bfs-list-course-category {
/** Level 0 */
> .bfs-list-course-category__nav {
margin-bottom: 1em;
background: #fff;
border-radius: 6px;
box-shadow: 0 0 20px 0 rgba(0,0,0,0.05);
padding: 1.5em 0;

> .bfs-list-course-category__nav-link {
display: block;
text-transform: uppercase;
font-size: var(--wp--preset--font-size--small);
font-weight: 700;
margin-bottom: 1em;
}
.bfs-list-course-category__nav-link {
padding: 0 1.5em;
}
}

/** Level 1+ */
> .bfs-list-course-category__nav .bfs-list-course-category__nav {
.bfs-list-course-category__nav-link {
display: block;
color: rgba(0,0,0,0.8);
font-size: var(--wp--preset--font-size--small);
font-weight: 600;
}
}

/** Level 2+ */
.bfs-list-course-category__nav.level-1 .bfs-list-course-category__nav {
//margin: 0.5em 0 0.5em 1em;
margin-left: 1em;

.bfs-list-course-category__nav-link {
display: block;
color: rgba(0,0,0,0.4);
}
}

/** Active */
.bfs-list-course-category__nav.level-0, .bfs-list-course-category__nav.level-1 {
> .bfs-list-course-category__nav-link.current {
border-left: 4px solid var(--wp--preset--color--primary);
margin-left: -2px;
padding-left: calc(1.5em - 2px);
}
}
.bfs-list-course-category__nav.level-1 .bfs-list-course-category__nav {
.bfs-list-course-category__nav-link.current {
color: var(--wp--preset--color--primary);
}
}
}
Loading

0 comments on commit 872f87e

Please sign in to comment.