[11/06/2024] Les premières modifs + installation de quelques modules indispensables

This commit is contained in:
2024-06-11 14:57:59 +02:00
parent 5ac5653ae5
commit 77cf2c7cc6
1626 changed files with 171457 additions and 131 deletions

View File

@@ -0,0 +1,10 @@
itemType: {$itemType} <br>
itemId: {$itemId}
<a href="{navigate to="current" force_legacy_imagemanager=true}">
use old image manager
</a>
<div id="imageManager"></div>
<script type="text/javascript" crossorigin src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script>
<script type="text/javascript" crossorigin src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script>

View File

@@ -0,0 +1,2 @@
<script src="{encore_module_asset file="tb-plugin/vendor/index.global.js" module="TheliaLibrary"}"></script>

View File

@@ -0,0 +1 @@
<link rel="stylesheet" href="{encore_module_asset file='tb-plugin/vendor/index.css' module="TheliaLibrary"}" />

View File

@@ -0,0 +1,488 @@
/* src/Input/Inputs.css */
.Input {
&__Wrapper {
@apply relative;
&__Header {
@apply flex justify-between;
}
&__Error {
@apply text-error mt-1 text-sm;
}
}
&__Text {
@apply relative w-full rounded-md border border-mediumGrey outline-none py-2 px-4;
height: 40px;
&__Wrapper {
@apply relative w-full flex flex-wrap items-stretch;
}
&:hover,
&:focus {
@apply border-darkCharbon;
}
&--withIcon {
@apply pl-10;
}
&--withIcons {
@apply px-10;
}
&--emphasize {
@apply text-vermillon;
}
}
&__Select {
background: url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='currentcolor' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat;
background-color: white;
background-position: calc(100% - 12px) center;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
&__Separator {
@apply absolute h-6 bg-darkCharbon bottom-2 right-8 z-10;
width: 1px;
}
}
&__Icon {
@apply absolute py-1 h-full leading-snug rounded text-base font-normal text-center flex items-center justify-center;
&--left {
@apply left-0 pr-5 pl-4;
}
&--right {
@apply right-0 pr-4 pl-5;
}
}
}
/* src/Library/Library.css */
.Modal-Library {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
height: max-content;
width: 90%;
max-height: 90%;
overflow: auto;
border-radius: 8px;
background-color: white;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 350ms;
}
.Modal-Upload {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
height: max-content;
width: 50%;
max-height: 90%;
overflow: auto;
border-radius: 8px;
background-color: white;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 350ms;
}
.Modal-Tags {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: max-content;
max-width: 700px;
height: max-content;
max-height: 80%;
border-radius: 8px;
background-color: white;
}
.Modal__Content__Loader {
display: flex;
flex-direction: column;
gap: 12px;
width: 100%;
text-align: center;
}
.Modal__Content__Loader span {
display: block;
}
.Library__NoContent {
width: 100%;
text-align: center;
}
.Library {
display: flex;
flex-direction: column;
gap: 30px;
}
.Library__Filters {
display: flex;
gap: 15px;
}
.Library__Filters .Input__Wrapper {
width: 400px;
}
.Library__Content {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.Library__Image {
display: flex;
flex-direction: column;
max-width: 160px;
height: max-content;
border: 1px solid #EBEBEB;
border-radius: 4px;
position: relative;
justify-content: center;
align-items: center;
gap: 10px;
padding-bottom: 16px;
}
.Library__Image img {
border-radius: 4px;
object-fit: contain;
}
.Library__Image__Title {
text-align: center;
overflow: hidden;
white-space: nowrap;
font-weight: 600;
text-overflow: ellipsis;
max-width: 130px;
}
.Library__Image__Action__Title {
text-align: center;
overflow: hidden;
white-space: nowrap;
font-weight: 600;
text-overflow: ellipsis;
max-width: 120px;
color: white;
}
.Library__Image__Tags {
position: absolute;
display: flex;
justify-content: flex-end;
gap: 4px;
flex-wrap: wrap;
top: 7px;
right: 7px;
}
.Library__Image__Tag {
width: 50px;
height: 20px;
border-radius: 20px;
text-align: center;
letter-spacing: 0.05em;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
background-color: white;
text-overflow: ellipsis;
overflow: hidden;
padding: 1px 3px;
}
.Library__Image__Actions {
display: none;
position: absolute;
background-color: rgba(0, 0, 0, 0.9);
height: 100%;
width: 100%;
top: 0;
border-radius: 4px;
}
.Library__Image__Actions__Wrapper {
display: flex;
gap: 0.5rem;
}
.Library__Add__Button {
display: flex;
align-items: center;
justify-content: center;
color: #fff;
border-radius: 100%;
background-color: #D21919;
cursor: pointer;
}
.Library__Add__Button:disabled {
background-color: #EBEBEB;
color: #fff;
}
.Library__Add__Button:enabled:hover {
background-color: #FA533C;
color: #fff;
}
.Library__Add__Button:hover {
background-color: transparent;
color: #222222;
}
.Library__Image:hover .Library__Image__Actions {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.Library__Image__Select__Action {
background: transparent;
border: 1px solid #fff;
color: #fff;
text-transform: uppercase;
padding: 6px 15px;
letter-spacing: 0.05em;
font-size: 12px;
font-weight: 600;
border-radius: 4px;
}
.Library__Image__Select__Action:hover {
background: #fff;
color: #000;
}
.Library__Image__Delete__Action {
background-color: #D21919;
border-radius: 100%;
width: 30px;
height: 30px;
color: #fff;
}
.Library__Image__Tag__Action {
background-color: #008958;
border-radius: 100%;
width: 30px;
height: 30px;
color: #fff;
}
.BlockImage__TagSelector {
display: flex;
align-items: center;
position: relative;
border-radius: 6px;
outline: none;
border: 1px solid #9B9B9B;
height: max-content;
min-height: 40px;
padding: 5px;
}
.BlockImage__TagSelector__Add {
position: absolute;
bottom: 3px;
right: 3px;
width: 32px;
height: 32px;
display: flex;
justify-content: center;
align-items: center;
color: white;
border-radius: 4px;
background-color: #444444;
}
.BlockImage__TagSelector__Add:hover {
background-color: #333333;
}
.BlockImage__TagSelector__Tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.BlockImage__TagSelector__Tag {
max-width: 100px;
width: max-content;
max-height: 30px;
text-overflow: ellipsis;
overflow: hidden;
border-radius: 90px;
display: flex;
justify-content: space-between;
background-color: #333333;
color: white;
align-items: center;
padding: 4px;
padding-left: 14px;
}
.BlockImage__TagSelector__Tag > span {
font-weight: 600;
font-size: 14px;
margin-right: 7px;
}
.BlockImage__TagSelector__Tag__Remove {
background-color: white;
color: #111;
border-radius: 90px;
height: 20px;
width: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.TagList {
top: 100%;
left: 0;
background-color: white;
border-radius: 6px;
overflow: auto;
width: 100%;
position: absolute;
z-index: 30;
max-height: 200px;
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.25);
}
.TagList__Item {
cursor: pointer;
display: flex;
flex-direction: column;
padding: 20px 15px;
}
.Select__Wrapper {
position: relative;
width: 250px;
}
@media screen and (max-width: 768px) {
.Library__Image__Title {
max-width: 100px;
}
.Library__Filters {
flex-direction: column;
}
.Library__Filters .Input__Wrapper,
.Library__Filters .Select__Wrapper {
width: auto;
}
.Library__Item {
padding: 0px;
}
}
/* src/Image/Image.css */
.BlockImage__Upload__Wrapper {
display: flex;
gap: 16px;
text-align: center;
}
.BlockImage__FromLibrary {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #fff;
border-radius: 4px;
padding: 50px 20px;
height: 200px;
}
.BlockImage__FromLibrary__Icon {
background-color: #f5f5f5;
padding: 10px;
border-radius: 100%;
margin-bottom: 10px;
}
.BlockImage__FromLocal {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 4px;
padding: 50px 20px;
height: 200px;
border: 1px dashed #787878;
}
.BlockImage__FromLocal.BlockImage__FromLocal--active {
border: 2px dashed #dc3018;
}
input.BlockImage__FromLocal__FileInput {
display: none;
}
.BlockImage__Button {
display: block;
cursor: pointer;
color: #dc3018;
font-weight: 600;
font-size: 12px;
line-height: 16px;
text-align: center;
letter-spacing: 0.05em;
text-transform: uppercase;
border: 1px solid #dc3018;
border-radius: 4px;
padding: 6px 15px;
}
.BlockImage__Button:hover {
background-color: #dc3018;
color: #fff;
}
.BlockImage__FromLocal__Icon {
margin-bottom: 10px;
}
.BlockImage__Infos__Form {
display: flex;
flex-direction: column;
justify-content: center;
gap: 16px;
width: 100%;
}
.BlockImage__Preview {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #fff;
border-radius: 4px;
gap: 18px;
max-width: 290px;
}
.BlockImage__Preview__Infos {
width: 100%;
}
.BlockImage__Preview img {
border: 1px solid #EBEBEB;
padding: 5px;
border-radius: 4px;
}
.BlockImage__Preview__FileName {
display: block;
font-weight: 600;
font-size: 14px;
line-height: 19px;
color: #333333;
margin-bottom: 10px;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.BlockImage__Infos {
display: flex;
gap: 40px;
}
.BlockImage__Upload--light .BlockImage__FromLocal,
.BlockImage__Upload--light .BlockImage__FromLibrary {
border: none;
background-color: inherit;
padding: 0px;
width: auto;
height: auto;
}
.BlockImage__Upload--light .BlockImage__FromLocal .BlockImage__FromLocal__Icon,
.BlockImage__Upload--light .BlockImage__FromLibrary .BlockImage__FromLibrary__Icon {
display: none;
}
@media screen and (max-width: 1366px) {
.BlockImage__Upload__Wrapper {
flex-direction: column;
}
.BlockImage__FromLibrary {
width: 100%;
}
.BlockImage__FromLocal {
width: 100%;
}
.BlockImage__Infos {
flex-direction: column;
}
}
/*# sourceMappingURL=index.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,44 @@
import { BlockPluginDefinition } from '@thelia/blocks-editor';
declare type ImageTag = {
imageTag: {
id: number;
imageId: number;
tagId: number;
};
tag: {
id: number;
title: string;
colorCode: string;
};
};
declare type LibraryImage = {
id: number | null;
fileName: string;
title: string;
tags: ImageTag[];
width: string;
height: string;
link?: {
url: string;
target?: string;
};
target: HTMLAnchorElement["target"];
};
declare const UploadImage: ({ onSelect, compact, uploadModes, }: {
onSelect: (image: LibraryImage) => void;
compact?: boolean | undefined;
uploadModes?: ("local" | "library")[] | undefined;
}) => JSX.Element;
declare const initialData: LibraryImage;
declare const blockImage: BlockPluginDefinition<LibraryImage>;
declare function WrappedComponent(props: {
isOpen: boolean;
setIsOpen: Function;
limit?: number;
onSelect: (image: LibraryImage) => void;
}): JSX.Element;
export { blockImage as BlockImage, initialData as BlockImageInitialData, LibraryImage, UploadImage, WrappedComponent as default };

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
{$hasLink = isset($data['link']) && isset($data['link']['url']) && $data['link']['url']}
{if $hasLink}
<a href="{$data['link']['url']}" {if isset($data['link']['target']) && $data['link']['target']}target="{$data['link']['target']}"{/if}>
{/if}
{if isset($data['id']|default:null)}
{loop type="library_image" name="library_image" id=$data['id']|default:null}
<img class="tb-{$type['id']|default:null}" src="{$URL}" alt="{$TITLE}" loading="lazy" style="{if $data['width'] != ""}width: {$data['width']};{/if} {if $data['height'] != ""}height: {$data['height']};{/if}" />
{/loop}
{else}
<img class="tb-{$type['id']|default:null}" src="{$data['url']|default:null}" alt="{$data['alt']|default:null}" loading="lazy" style="{if $data['width'] != ""}width: {$data['width']};{/if} {if $data['height'] != ""}height: {$data['height']};{/if}" />
{/if}
{if $hasLink}
</a>
{/if}