updating old blocks with kit presse because had a bug to fix
This commit is contained in:
parent
a14ce1610c
commit
2e4011b6d1
18
blocks/_oldBlocks/kit-presse/.editorconfig
Normal file
18
blocks/_oldBlocks/kit-presse/.editorconfig
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
# WordPress Coding Standards
|
||||
# https://make.wordpress.org/core/handbook/coding-standards/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
30
blocks/_oldBlocks/kit-presse/.gitignore
vendored
Normal file
30
blocks/_oldBlocks/kit-presse/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Output of `npm pack`
|
||||
*.tgz
|
||||
|
||||
# Output of `wp-scripts plugin-zip`
|
||||
*.zip
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
28850
blocks/_oldBlocks/kit-presse/package-lock.json
generated
Normal file
28850
blocks/_oldBlocks/kit-presse/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
blocks/_oldBlocks/kit-presse/package.json
Normal file
20
blocks/_oldBlocks/kit-presse/package.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "test",
|
||||
"version": "0.1.0",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"author": "The WordPress Contributors",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"main": "build/index.js",
|
||||
"scripts": {
|
||||
"build": "wp-scripts build --webpack-copy-php",
|
||||
"format": "wp-scripts format",
|
||||
"lint:css": "wp-scripts lint-style",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"packages-update": "wp-scripts packages-update",
|
||||
"plugin-zip": "wp-scripts plugin-zip",
|
||||
"start": "wp-scripts start --webpack-copy-php"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^26.11.0"
|
||||
}
|
||||
}
|
||||
18
blocks/_oldBlocks/kit-presse/src/block.json
Normal file
18
blocks/_oldBlocks/kit-presse/src/block.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/kit-presse",
|
||||
"version": "0.1.0",
|
||||
"title": "Kit Presse",
|
||||
"category": "homegrade-blocks",
|
||||
"icon": "smiley",
|
||||
"description": "Un bloc pour afficher les photos pour la presse",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "test",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
35
blocks/_oldBlocks/kit-presse/src/edit.js
Normal file
35
blocks/_oldBlocks/kit-presse/src/edit.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import { useBlockProps } from "@wordpress/block-editor";
|
||||
import { InnerBlocks } from "@wordpress/block-editor";
|
||||
import "./editor.scss";
|
||||
|
||||
export default function Edit() {
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-kit-presse`,
|
||||
})}
|
||||
>
|
||||
<InnerBlocks
|
||||
allowedBlocks={[
|
||||
"homegrade-content-blocks/section-titling",
|
||||
"core/paragraph",
|
||||
]}
|
||||
template={[
|
||||
[
|
||||
"homegrade-content-blocks/section-titling",
|
||||
{ sectionTitle: __("Kit presse", "homegrade") },
|
||||
],
|
||||
["core/paragraph"],
|
||||
]}
|
||||
templateLock={true}
|
||||
/>
|
||||
<p className="temp_guidance_sentence">
|
||||
{__(
|
||||
"Les éléments déposés dans le kit press s'afficheront ici",
|
||||
"homegrade-blocks__text-backoffice"
|
||||
)}
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
9
blocks/_oldBlocks/kit-presse/src/editor.scss
Normal file
9
blocks/_oldBlocks/kit-presse/src/editor.scss
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.wp-block-create-block-test {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
43
blocks/_oldBlocks/kit-presse/src/img/homegrade_fiches.svg
Normal file
43
blocks/_oldBlocks/kit-presse/src/img/homegrade_fiches.svg
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="fiches" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 35.23 43.15">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1, .cls-2 {
|
||||
stroke-width: 0px;
|
||||
}
|
||||
|
||||
.cls-1, .cls-3, .cls-4 {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
fill: url(#Dégradé_sans_nom_5);
|
||||
}
|
||||
|
||||
.cls-3, .cls-4 {
|
||||
stroke: #000;
|
||||
stroke-linecap: round;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
</style>
|
||||
<linearGradient id="Dégradé_sans_nom_5" data-name="Dégradé sans nom 5" x1="-1662.48" y1="-15.41" x2="-1660.8" y2="-17.17" gradientTransform="translate(16763.7 -47.81) scale(10.08 -3.91)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#f3281d"/>
|
||||
<stop offset="1" stop-color="#fe766f"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="Groupe_4723" data-name="Groupe 4723">
|
||||
<g id="Rectangle_1361" data-name="Rectangle 1361">
|
||||
<rect class="cls-1" y="5.55" width="29.14" height="37.6"/>
|
||||
<rect class="cls-4" x="1.68" y="7.23" width="25.78" height="34.24"/>
|
||||
</g>
|
||||
<rect id="Rectangle_1362" data-name="Rectangle 1362" class="cls-2" x="6.09" y="11.98" width="16.97" height="6.58"/>
|
||||
<line id="Ligne_3477" data-name="Ligne 3477" class="cls-3" x1="7.03" y1="22.94" x2="22.11" y2="22.94"/>
|
||||
<line id="Ligne_3478" data-name="Ligne 3478" class="cls-3" x1="7.03" y1="28.26" x2="22.11" y2="28.26"/>
|
||||
<line id="Ligne_3479" data-name="Ligne 3479" class="cls-3" x1="7.03" y1="33.58" x2="22.11" y2="33.58"/>
|
||||
<path id="Tracé_20354" data-name="Tracé 20354" class="cls-4" d="m7.02,3.54V1h27.2v37.5h-3.02"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
28
blocks/_oldBlocks/kit-presse/src/img/homegrade_image.svg
Normal file
28
blocks/_oldBlocks/kit-presse/src/img/homegrade_image.svg
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="image" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 35.24 35.24">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: url(#Dégradé_sans_nom_5);
|
||||
stroke-width: 0px;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
fill: none;
|
||||
stroke: #000;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
</style>
|
||||
<linearGradient id="Dégradé_sans_nom_5" data-name="Dégradé sans nom 5" x1="-2760.13" y1="75.52" x2="-2759.14" y2="74.47" gradientTransform="translate(23623.33 653.57) scale(8.56 -8.56)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#f3281d"/>
|
||||
<stop offset="1" stop-color="#fe766f"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="Icon_feather-image" data-name="Icon feather-image">
|
||||
<path id="Tracé_24544" data-name="Tracé 24544" class="cls-2" d="m4.69,1h25.85c2.04,0,3.69,1.65,3.69,3.69h0v25.85c0,2.04-1.65,3.69-3.69,3.69H4.69c-2.04,0-3.69-1.65-3.69-3.69h0V4.69c0-2.04,1.65-3.69,3.69-3.69Z"/>
|
||||
<path id="Tracé_24545" data-name="Tracé 24545" class="cls-1" d="m15.45,11.18c0,2.36-1.92,4.28-4.28,4.28s-4.28-1.92-4.28-4.28,1.91-4.28,4.28-4.28c2.36,0,4.28,1.91,4.28,4.28h0Z"/>
|
||||
<path id="Tracé_24546" data-name="Tracé 24546" class="cls-2" d="m34.24,23.16l-9.23-9.23L4.69,34.24"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
24
blocks/_oldBlocks/kit-presse/src/index.js
Normal file
24
blocks/_oldBlocks/kit-presse/src/index.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import "./style.scss";
|
||||
import Edit from "./edit";
|
||||
import save from "./save";
|
||||
|
||||
import metadata from "./block.json";
|
||||
|
||||
registerBlockType(metadata.name, {
|
||||
icon: {
|
||||
src: (
|
||||
<svg viewBox="0 0 39.37 34.38">
|
||||
<g id="Calque_1-2" data-name="Calque 1">
|
||||
<path
|
||||
class="cls-1"
|
||||
d="m36.32,6.95h-7.23v-3.91c0-1.68-1.36-3.05-3.05-3.05h-12.71c-1.69,0-3.05,1.37-3.05,3.05v3.91H3.05c-1.68,0-3.05,1.37-3.05,3.05v21.33c0,1.68,1.37,3.05,3.05,3.05h13.22v-5.87c-2.49-1.27-4.06-3.83-4.06-6.66s1.47-5.21,3.84-6.53c.24-.14.54-.13.78,0,.24.14.39.4.39.68v4.81l2.47,1.15,2.47-1.15v-4.81c0-.28.15-.54.39-.68.24-.14.54-.14.78,0,2.37,1.32,3.84,3.82,3.84,6.53s-1.58,5.39-4.07,6.66v5.87h13.22c1.68,0,3.06-1.37,3.06-3.05V10c0-1.68-1.37-3.05-3.06-3.05Zm-8.8,0h-15.65v-3.91c0-.81.66-1.47,1.47-1.47h12.71c.81,0,1.47.66,1.47,1.47v3.91Z"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
),
|
||||
foreground: "#DF1E1E",
|
||||
},
|
||||
edit: Edit,
|
||||
save,
|
||||
});
|
||||
60
blocks/_oldBlocks/kit-presse/src/render.php
Normal file
60
blocks/_oldBlocks/kit-presse/src/render.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
$press_kit_datas = get_field('press_kit_datas', 'option');
|
||||
|
||||
|
||||
function getRessourceIcon($ressource_type)
|
||||
{
|
||||
switch ($ressource_type) {
|
||||
case 'image/jpeg':
|
||||
return plugin_dir_url(__DIR__) . "src/img/homegrade_image.svg";
|
||||
|
||||
case 'application/pdf':
|
||||
return plugin_dir_url(__DIR__) . "src/img/homegrade_fiches.svg";
|
||||
|
||||
default:
|
||||
return plugin_dir_url(__DIR__) . "src/img/homegrade_fiches.svg";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<h1>sasmljkdcbsmkdjfbds</h1>
|
||||
<section <?php echo get_block_wrapper_attributes(["class" => "homegrade-blocks-kit-presse"]); ?>>
|
||||
<?php echo $content; ?>
|
||||
|
||||
<ul class="homegrade-blocks-kit-presse__press-grid-datas">
|
||||
|
||||
<div class="table_head">
|
||||
<p><?php echo __("Fichier", "homegrade-blocks__texte-fonctionnel") ?></p>
|
||||
<p><?php echo __("Format", "homegrade-blocks__texte-fonctionnel") ?></p>
|
||||
<p><?php echo __("Mise à jour", "homegrade-blocks__texte-fonctionnel") ?></p>
|
||||
</div>
|
||||
<?php foreach ($press_kit_datas as $data) : ?>
|
||||
<?php
|
||||
$ressourceType = $data['mime_type'];
|
||||
$ressourceIcon = getRessourceIcon($ressourceType);
|
||||
|
||||
|
||||
setlocale(LC_TIME, 'fr_FR');
|
||||
$timestamp = strtotime($data['modified']);
|
||||
$formatted_date = strftime("%B %Y", $timestamp);
|
||||
|
||||
?>
|
||||
<li class="homegrade-blocks-kit-presse__press-ressource">
|
||||
<div class="homegrade-blocks-kit-presse__ressource-icon">
|
||||
<img src="<?php echo $ressourceIcon ?>" alt="">
|
||||
</div>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-title"><?php echo $data['title'] ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-type"><?php echo $data['subtype'] ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-date"><?php echo $formatted_date ?></p>
|
||||
<a class="homegrade-blocks-kit-presse__ressource-download cta cta--secondary cta--button" href=""><?php echo __('Télécharger') ?></a>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
5
blocks/_oldBlocks/kit-presse/src/save.js
Normal file
5
blocks/_oldBlocks/kit-presse/src/save.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
|
||||
|
||||
export default function save({ attributes }) {
|
||||
return <InnerBlocks.Content />;
|
||||
}
|
||||
12
blocks/_oldBlocks/kit-presse/src/style.scss
Normal file
12
blocks/_oldBlocks/kit-presse/src/style.scss
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* The following styles get applied both on the front of your site
|
||||
* and in the editor.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.wp-block-create-block-test {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user