From 3804d13cb68b28e5167a0792df2031039077ef72 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Sat, 6 Apr 2024 10:08:45 +0200 Subject: [PATCH] adjust styles --- assets/css/src/header.css | 13 + assets/css/src/html.css | 4 +- assets/css/src/tabs.css | 25 ++ assets/css/src/texts.css | 20 +- assets/css/src/variables.css | 4 +- assets/front-comments/icons/accept.svg | 17 + .../front-comments/icons/chat-box-empty.svg | 14 + assets/front-comments/icons/chat-box-plus.svg | 20 ++ .../icons/chat-box-text-select.svg | 15 + assets/front-comments/icons/decline.svg | 17 + assets/front-comments/icons/delete.svg | 14 + assets/front-comments/icons/gitlab.svg | 1 + assets/front-comments/index.css | 1 + assets/front-comments/index.js | 35 ++ assets/front-comments/style.css | 309 ++++++++++++++++++ assets/js/script.js | 27 +- composer.json | 3 +- composer.lock | 31 +- .../blueprints/pages/{blocks.yml => grid.yml} | 8 +- site/blueprints/pages/linear.yml | 1 + site/blueprints/pages/year.yml | 3 +- site/blueprints/tabs/meta.yml | 3 +- site/config/config.php | 84 +---- site/config/menu.php | 56 ++++ site/config/routes/virtual-author.php | 25 ++ site/config/routes/virtual-category.php | 22 ++ site/plugins/front-comments | 1 - site/snippets/header.php | 6 +- site/snippets/tabs.php | 54 ++- site/snippets/text-item.php | 13 + site/templates/author.php | 2 +- site/templates/category.php | 49 +++ site/templates/home.php | 8 +- site/templates/linear.php | 25 +- 34 files changed, 756 insertions(+), 174 deletions(-) create mode 100644 assets/front-comments/icons/accept.svg create mode 100644 assets/front-comments/icons/chat-box-empty.svg create mode 100644 assets/front-comments/icons/chat-box-plus.svg create mode 100644 assets/front-comments/icons/chat-box-text-select.svg create mode 100644 assets/front-comments/icons/decline.svg create mode 100644 assets/front-comments/icons/delete.svg create mode 100644 assets/front-comments/icons/gitlab.svg create mode 100644 assets/front-comments/index.css create mode 100644 assets/front-comments/index.js create mode 100644 assets/front-comments/style.css rename site/blueprints/pages/{blocks.yml => grid.yml} (75%) create mode 100644 site/config/menu.php create mode 100644 site/config/routes/virtual-author.php create mode 100644 site/config/routes/virtual-category.php delete mode 160000 site/plugins/front-comments create mode 100644 site/snippets/text-item.php create mode 100644 site/templates/category.php diff --git a/assets/css/src/header.css b/assets/css/src/header.css index c6cc7cc..d6e10b7 100644 --- a/assets/css/src/header.css +++ b/assets/css/src/header.css @@ -42,6 +42,19 @@ padding-bottom: calc(5 * var(--unit--vertical)); } +#home .page-cover { + padding-top: 30svh; +} + +#category .page-cover { + height: auto; + padding-bottom: 0; + margin-bottom: calc(2 * var(--unit--vertical)); +} +#category .active-tab { + max-height: none; +} + @media screen and (min-width: 640px) { #main-header { display: flex; diff --git a/assets/css/src/html.css b/assets/css/src/html.css index 3db9f3d..ad24a9d 100644 --- a/assets/css/src/html.css +++ b/assets/css/src/html.css @@ -29,7 +29,7 @@ html { * { scrollbar-width: thin; - scrollbar-color: rgba(0, 0, 0, 0.1) transparent; + scrollbar-color: transparent transparent; } /* Works on Chrome, Edge, and Safari */ @@ -44,7 +44,7 @@ html { } *::-webkit-scrollbar-thumb { - background-color: rgba(0, 0, 0, 0.1); + background-color: transparent; border-radius: 0px; border: none; } diff --git a/assets/css/src/tabs.css b/assets/css/src/tabs.css index 8a48778..36a9ebd 100644 --- a/assets/css/src/tabs.css +++ b/assets/css/src/tabs.css @@ -30,6 +30,7 @@ button.toggle.right.open::before { margin-top: -25svh; margin-bottom: 30svh; transition: margin-top 0.5s ease-in-out; + z-index: 1; } #tabs.open { @@ -42,6 +43,30 @@ button.toggle.right.open::before { margin-top: var(--unit--vertical); transition: max-height 0.5s ease-in-out; } +/* ================= SCROLLBAR ================= */ +/* Works on Firefox */ + +.active-tab { + scrollbar-width: thin; + scrollbar-color: #fff transparent; +} + +/* Works on Chrome, Edge, and Safari */ + +.active-tab::-webkit-scrollbar { + width: 3px; + height: auto; +} + +.active-tab::-webkit-scrollbar-track { + background: transparent; +} + +.active-tab::-webkit-scrollbar-thumb { + background-color: #fff; + border-radius: 1px; + border: none; +} .page-cover.open .active-tab { height: calc(100svh - 7.5 * var(--unit--vertical)); diff --git a/assets/css/src/texts.css b/assets/css/src/texts.css index 367fb12..8df6e56 100644 --- a/assets/css/src/texts.css +++ b/assets/css/src/texts.css @@ -8,6 +8,11 @@ font-style: normal; } +.accent { + color: var(--color-secondary); + font-weight: normal; +} + * { font-family: "Switzer-Variable", sans-serif; } @@ -41,13 +46,20 @@ article h2 { --margin-left: calc(4 * var(--unit--horizontal)); width: calc(100% - var(--margin-left)); margin-left: var(--margin-left); + font-size: var(--font-size-l); + line-height: var(--unit--vertical); } .main-title { - line-height: 1; + line-height: calc(var(--unit--vertical) * 2); text-align: left; box-sizing: border-box; font-weight: var(--font-weight-light); + margin-bottom: var(--unit--vertical); +} + +.texts__title { + font-size: var(--font-size-l); } p, @@ -70,9 +82,11 @@ button, } .fs-xl { font-size: var(--font-size-xl) !important; + line-height: calc(var(--unit--vertical) * 1.5) !important; } .fs-xxl { font-size: var(--font-size-xxl) !important; + line-height: calc(var(--unit--vertical) * 2.5) !important; } p, @@ -121,8 +135,8 @@ a:not(.no-line):hover { } a:not(.no-line) { - text-decoration: dotted; - text-decoration-color: #fff; + text-decoration: underline; + text-decoration-color: inherit; text-decoration-line: underline; text-underline-offset: 0.2rem; text-decoration-thickness: 0.5px; diff --git a/assets/css/src/variables.css b/assets/css/src/variables.css index 3fe446a..9cf2456 100644 --- a/assets/css/src/variables.css +++ b/assets/css/src/variables.css @@ -3,8 +3,8 @@ --color-primary: #ffffff; --color-primary--transparent: rgba(255, 255, 255, 0.86); --color-secondary: rgb(120, 171, 150, 0.86); - --color-secondary--light: rgb(119, 177, 157, 0.25); - --color-secondary--x-light: rgb(119, 177, 157, 0.15); + --color-secondary--light: rgb(119, 177, 157, 0.2); + --color-secondary--x-light: rgb(119, 177, 157, 0.1); --unit--horizontal: 5vw; --unit--vertical: 1.7rem; diff --git a/assets/front-comments/icons/accept.svg b/assets/front-comments/icons/accept.svg new file mode 100644 index 0000000..76352cb --- /dev/null +++ b/assets/front-comments/icons/accept.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/front-comments/icons/chat-box-empty.svg b/assets/front-comments/icons/chat-box-empty.svg new file mode 100644 index 0000000..42cea3b --- /dev/null +++ b/assets/front-comments/icons/chat-box-empty.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/front-comments/icons/chat-box-plus.svg b/assets/front-comments/icons/chat-box-plus.svg new file mode 100644 index 0000000..ec99631 --- /dev/null +++ b/assets/front-comments/icons/chat-box-plus.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/front-comments/icons/chat-box-text-select.svg b/assets/front-comments/icons/chat-box-text-select.svg new file mode 100644 index 0000000..7326afc --- /dev/null +++ b/assets/front-comments/icons/chat-box-text-select.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/front-comments/icons/decline.svg b/assets/front-comments/icons/decline.svg new file mode 100644 index 0000000..cd5a56d --- /dev/null +++ b/assets/front-comments/icons/decline.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/front-comments/icons/delete.svg b/assets/front-comments/icons/delete.svg new file mode 100644 index 0000000..a18c05e --- /dev/null +++ b/assets/front-comments/icons/delete.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/front-comments/icons/gitlab.svg b/assets/front-comments/icons/gitlab.svg new file mode 100644 index 0000000..b4ae72b --- /dev/null +++ b/assets/front-comments/icons/gitlab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/front-comments/index.css b/assets/front-comments/index.css new file mode 100644 index 0000000..1afa00c --- /dev/null +++ b/assets/front-comments/index.css @@ -0,0 +1 @@ +h2[data-v-019dfc9e]{margin-bottom:1rem}.k-table .k-table-index-column[data-v-019dfc9e]{width:6rem} diff --git a/assets/front-comments/index.js b/assets/front-comments/index.js new file mode 100644 index 0000000..506bd0d --- /dev/null +++ b/assets/front-comments/index.js @@ -0,0 +1,35 @@ +(function(){"use strict";const p={comments:[],suggestions:[],author:null,page:{id:null,uri:null},csrf:null,save(f){const t={};t[f]=this[f];const u={method:"PATCH",headers:{"X-CSRF":this.csrf},body:JSON.stringify(t).replaceAll("_","")};return fetch("/api/pages/"+this.page.id,u).then(c=>c.ok?c.json():Promise.reject("Front comments plugin - can't add comment: "+c.statusText)).then(c=>{console.log(c),console.log("Front comments plugin - comment successfully added.")}).catch(c=>Promise.reject(c))}};var R=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var U={exports:{}};(function(f,t){(function(u,c){f.exports=c()})(R,function(){var u=1e3,c=6e4,b=36e5,P="millisecond",w="second",M="minute",C="hour",D="day",j="week",y="month",J="quarter",x="year",E="date",Z="Invalid Date",it=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ot={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var s=["th","st","nd","rd"],e=r%100;return"["+r+(s[(e-20)%10]||s[e]||s[0])+"]"}},I=function(r,s,e){var i=String(r);return!i||i.length>=s?r:""+Array(s+1-i.length).join(e)+r},at={s:I,z:function(r){var s=-r.utcOffset(),e=Math.abs(s),i=Math.floor(e/60),n=e%60;return(s<=0?"+":"-")+I(i,2,"0")+":"+I(n,2,"0")},m:function r(s,e){if(s.date()1)return r(a[0])}else{var h=s.name;L[h]=s,n=h}return!i&&n&&(W=n),n||!i&&W},m=function(r,s){if(N(r))return r.clone();var e=typeof s=="object"?s:{};return e.date=r,e.args=arguments,new F(e)},d=at;d.l=H,d.i=N,d.w=function(r,s){return m(r,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var F=function(){function r(e){this.$L=H(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[V]=!0}var s=r.prototype;return s.parse=function(e){this.$d=function(i){var n=i.date,o=i.utc;if(n===null)return new Date(NaN);if(d.u(n))return new Date;if(n instanceof Date)return new Date(n);if(typeof n=="string"&&!/Z$/i.test(n)){var a=n.match(it);if(a){var h=a[2]-1||0,l=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],h,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)):new Date(a[1],h,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)}}return new Date(n)}(e),this.init()},s.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},s.$utils=function(){return d},s.isValid=function(){return this.$d.toString()!==Z},s.isSame=function(e,i){var n=m(e);return this.startOf(i)<=n&&n<=this.endOf(i)},s.isAfter=function(e,i){return m(e) + ${this.author.slice(0,1)} + `);return t.addEventListener("mouseenter",()=>{setTimeout(()=>{this.expand()},10)}),this.node=t,t}expand(){const t=this.windowWidth?`
  • + Largeur fenêtre : ${this.windowWidth}px +
  • `:"",u=this.userAgent?`
  • + Agent utilisateur :
    + ${this.userAgent} +
  • `:"",c=this.userAgent||this.windowWidth?` +
    + + +
    +
      + ${t} + ${u} +
    +
    +
    + `:"",b=this._injectNode(`
    + + ${this.author}
    ${this.date} à ${this.time}
    + +

    ${this.message}

    + ${c} +
    `);q.fixOffscreen(b),b.querySelector(".fc__comment-delete").addEventListener("click",()=>{this.remove()});const w=document.querySelector(".fc__open-window");return w&&w.addEventListener("click",()=>{window.open(window.location.href,"",`width=${this.windowWidth}, height=800`)}),b.addEventListener("mouseleave",()=>{setTimeout(()=>{this.toBubble()},10)}),this.node=b,b}_injectNode(t){this.node&&document.body.removeChild(this.node);const u=document.createElement("div");u.innerHTML=t;const c=u.firstChild;return document.body.appendChild(c),c}async remove(){const t={method:"PATCH"};fetch(`/comments/delete/${this.id}/${p.page.uri}.json`,t).then(u=>u.json()).then(u=>{p.comments=p.comments.filter(c=>c.id!=this.id),document.body.removeChild(this.node)}).catch(u=>{console.log(u)})}}class et{constructor(){this._panel,this._textArea}create(){this._panel=this._createPanel(),this._textArea=this._createTextArea();const t=this._createBtns();this._panel.appendChild(this._textArea),this._panel.appendChild(t),document.body.appendChild(this._panel),this._textArea.focus(),q.fixOffscreen(this._panel),document.querySelector(".fc__edition-panel__remove-btn").addEventListener("click",()=>{document.body.removeChild(this._panel)})}_createPanel(){const t=document.createElement("div");return t.classList.add("fc__edition-panel"),t.style.left=this._getMousePos().x+"px",t.style.top=this._getMousePos().y+window.scrollY+"px",t}_createBtns(){const t=document.createElement("div");t.classList.add("fc__edition-panel__btns");const u=document.createElement("button");u.classList.add("fc__edition-panel__remove-btn"),u.textContent="supprimer";const c=document.createElement("button");return c.classList.add("fc__edition-panel__save-btn"),c.textContent="enregistrer",t.appendChild(u),t.appendChild(c),t}_getMousePos(){return{x:event.clientX,y:event.clientY}}_createTextArea(){const t=document.createElement("textarea");return t.classList.add("fc__text"),t}_getPos(){const t=this._panel.offsetLeft/((window.innerWidth+window.pageXOffset)/100);return{top:this._panel.style.top,left:t+"vw"}}}class z{constructor(){this.position={},this.author="",this.message="",this.id=Date.now(),this.date=X().format("DD/MM/YY"),this.time=X().format("HH:mm"),this.windowWidth=window.innerWidth,this.userAgent=navigator.userAgent}setPosition(t){return this.position=t,this}setAuthor(t){return this.author=t,this}setMessage(t){return this.message=t,this}setId(t){return this.id=t,this}setDate(t){return this.date=t,this}setTime(t){return this.time=t,this}setWindowWidth(t){return this.windowWidth=t,this}setUserAgent(t){return this.userAgent=t,this}build(){return!this.position||!this.author||!this.message?(console.error("Missing required parameters for Comment: position, author, message",this),null):new tt(this.position,this.author,this.message,this.id,this.date,this.time,this.windowWidth,this.userAgent)}}class nt extends et{create(){super.create(),document.querySelector(".fc__edition-panel__save-btn").addEventListener("click",()=>{this._createComment()}),this._textArea.addEventListener("keydown",t=>{t.key==="Enter"&&this._createComment(),t.key==="Escape"&&document.body.removeChild(this._panel)})}async _createComment(){const t=new z().setAuthor(p.author).setMessage(this._textArea.value).setPosition({top:this._getPos().top,left:this._getPos().left}).build();try{p.comments.push(t),await p.save("comments"),t.toBubble(),document.body.removeChild(this._panel)}catch(u){p.comments=p.comments.filter(c=>c.id!==t.id),document.body.removeChild(t.node),console.error("Create comment failed:",u)}return t}}class st{constructor(t){this._button=this._createButton(t),this._initEventListeners()}_createButton(t){const u=document.createElement("div");u.innerHTML=``;const c=u.firstChild;return document.body.appendChild(c),c}_initEventListeners(){this._button.addEventListener("click",this._handleClick.bind(this)),window.addEventListener("mousemove",this._handleMouseMove.bind(this)),window.addEventListener("keydown",this._handleKeyDown.bind(this))}_handleClick(t){this._button.classList.contains("fc__btn-add--move")&&(new nt().create(),this._resetPosition()),this._button.classList.toggle("fc__btn-add--move")}_handleMouseMove(t){this._button.classList.contains("fc__btn-add--move")&&(this._button.style.left=t.clientX-48/2+"px",this._button.style.top=t.clientY+window.scrollY-48/2+"px")}_handleKeyDown(t){t.key==="Escape"&&(this._button.classList.remove("fc__btn-add--move"),this._resetPosition())}_resetPosition(){this._button.style.left="",this._button.style.top=""}}document.addEventListener("DOMContentLoaded",()=>{p.author=FCAuthor,p.page.id=FCPageId,p.page.uri=FCPageUri,p.csrf=FCCsrf,p.filesPath=FCFilesPath;try{JSON.parse(FCComments).forEach(t=>{const u=new z().setPosition(t.position).setAuthor(t.author).setMessage(t.message).setId(t.id).setDate(t.date).setTime(t.time).setWindowWidth(t.windowWidth).setUserAgent(t.userAgent).build();u.toBubble(),p.comments.push(u)})}catch(f){console.error("Plugin Front Comments : can't parse comments : ",f),console.log("Comments : ",FCComments)}new st(FCPosition)})})(); diff --git a/assets/front-comments/style.css b/assets/front-comments/style.css new file mode 100644 index 0000000..a3d8566 --- /dev/null +++ b/assets/front-comments/style.css @@ -0,0 +1,309 @@ +:root { + --fc-border: 2px solid #000; + --fc-border-light: 1px solid #999; + --fc-font-size-m: 1.2rem; + --fc-font-size-s: calc(var(--fc-font-size-m) / 1.3); +} + +.fc__btn { + border: none; + background-color: transparent; + padding: 0; + cursor: pointer; +} +.fc__btn:not(.fc__bubble):hover, +.fc__btn-add.fc__btn-add--move { + filter: invert(100%); +} +.fc__icon { + width: 100%; +} + +.fc__bubble, +.fc__btn-add { + z-index: 999; +} +.fc__btn-add:focus { + outline: none !important; +} + +.fc__edition-panel, +.fc__btn-add, +.fc__bubble { + z-index: 999; +} + +.fc__btn-add { + position: fixed; + width: 3rem; + height: 2.5rem; + cursor: pointer; +} +.fc__btn-add--bottom-right { + bottom: 1rem; + right: 1rem; +} +.fc__btn-add--bottom-left { + bottom: 1rem; + left: 1rem; +} +.fc__btn-add--top-left { + top: 1rem; + left: 1rem; +} +.fc__btn-add--top-right { + top: 1rem; + right: 1rem; +} + +.fc__btn-add .fc__plus { + width: 3rem; + height: 3rem; + display: inline-block; + transform: translateY(-2px); +} +.fc__btn-add:not(.fc__btn-add--move) { + top: auto !important; + left: auto !important; +} +.fc__btn-add.fc__btn-add--move { + position: absolute; + cursor: none !important; +} + +.fc__btn-add--field { + right: 5rem; +} + +.fc__edition-panel { + --panel-width: 15rem; + position: absolute; + padding-bottom: 0; +} + +.fc__edition-panel--left { + transform: translateX(calc(0rem - var(--panel-width))); +} +.fc__edition-panel--top { + transform: translateY(calc(0rem - 150px)); +} + +.fc__edition-panel textarea { + position: relative !important; + resize: none !important; + color: #000 !important; + font-family: sans-serif !important; + font-weight: 100 !important; + + width: var(--panel-width) !important; + height: 7rem !important; + outline: none !important; + border: var(--fc-border) !important; + padding: 0.5rem !important; +} + +.fc__edition-panel textarea:focus { + outline: none !important; +} + +.fc__edition-panel__btns { + display: flex; + background-color: #fff; + margin-top: 0.5rem; +} + +.fc__edition-panel__btns button { + all: initial; + + color: #000; + font-family: sans-serif; + font-weight: 100; + text-align: center; + font-size: 1rem; + + width: 100%; + padding: 0.5rem; + border: var(--fc-border) !important; + background-color: #fff; + cursor: pointer; +} +.fc__edition-panel__btns button:first-child { + border-right: none !important; +} + +.fc__edition-panel__btns button:hover { + background-color: #eee; +} + +.fc__bubble { + position: absolute; + display: flex; + justify-content: center; + align-items: center; + + width: 3rem; + height: 2.9rem; + scroll-margin-top: 6rem; + + color: #000; + font-family: sans-serif; + font-size: var(--fc-font-size-m); + font-weight: 500; + + background-image: var(--fc-icon-chat-box-empty); + background-size: 3rem 2.5rem; + background-position: 0 4px; + background-repeat: no-repeat; +} + +.fc__comment { + position: absolute; + z-index: 999; + + width: 20rem; + padding: 1rem; + background-color: #fff; + border: var(--fc-border) !important; +} + +.fc__comment * { + color: #000 !important; + font-family: sans-serif !important; + font-weight: 100 !important; +} + +.fc__comment p { + margin: 1rem 0 !important; +} + +.fc__comment-delete { + position: absolute; + right: 1rem; + top: 1rem; +} + +.fc__icon { + width: 1.5rem; + height: 1.5rem; +} + +.fc__comment, +.fc__edition-panel { + font-family: sans-serif; + font-size: var(--fc-font-size-m); + font-weight: 100; +} + +/* ================= CONTEXT ================= */ +#collapsible { + display: none; +} + +.fc__label-toggle { + display: block; + font-size: var(--fc-font-size-s); + cursor: pointer; +} + +.fc__label-toggle::before { + content: " "; + display: inline-block; + + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid currentColor; + + vertical-align: middle; + margin-right: 0.7rem; + transform: translateY(-2px); + + transition: transform 0.2s ease-out; +} + +.fc__collapsible-content { + max-height: 0px; + overflow: hidden; + + transition: max-height 0.25s ease-in-out; +} + +.fc__toggle:checked + .fc__label-toggle + .fc__collapsible-content { + max-height: 100vh; +} +.fc__toggle:checked + .fc__label-toggle::before { + transform: rotate(90deg) translateX(-3px); +} + +.fc__content-inner { + margin: 0; + margin-top: 1rem; + padding-left: 0; +} + +.fc__context-item { + list-style-type: none; + font-size: var(--fc-font-size-s); + line-height: 1.3; +} +.fc__context-item:not(:last-child) { + padding-bottom: 0.5rem; + margin-bottom: 0.5rem; + border-bottom: 1px dotted #000; +} + +.fc__open-window { + background-color: transparent; + border: 1px solid #000; + border-radius: 0; + cursor: pointer; + margin-left: 1rem; +} + +.fc__open-window:hover { + background-color: #000; + color: #fff !important; +} +/* ================= END CONTEXT ================= */ + +.fc__author { + font-weight: 400; +} + +.fc__datetime { + font-size: var(--fc-font-size-s); +} + +.fc__suggestion { + position: relative; + padding: 0.1rem 0.2rem; + margin: 0 0.2rem; + background-color: inherit; + border: var(--fc-border); +} +.fc__suggestion:hover { + color: #fff; + background-color: #000; +} +.fc__suggestion--edit { + background-color: rgba(0, 0, 0, 0.1) !important; +} + +.fc__suggestion-bubble { + position: absolute; + z-index: 999; + width: 20vw; + background-color: #fff; + color: #000; + border: var(--fc-border); + padding: 1rem; + left: -0.1rem; + bottom: -5.5rem; +} + +.fc__suggestion-bubble__btns { + position: absolute; + top: 1rem; + right: 1rem; + display: flex; + column-gap: 0.5rem; +} diff --git a/assets/js/script.js b/assets/js/script.js index afb626b..a9344ad 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -3,11 +3,14 @@ const verticalUnit = 1.3 * remFactor; function toggleTab(data, tab) { if (data.activeTab === tab) { - scrollToElem("body"); + window.scrollTo({ + top: 0, + behavior: "smooth", + }); setTimeout(() => { - data.activeTab = ""; data.isOpen = false; - }, 200); + data.activeTab = ""; + }, 300); } else { data.activeTab = tab; data.isOpen = true; @@ -28,6 +31,24 @@ function scrollToElem(selector) { }, 100); } +function setWindowHeightFactor() { + const windowHeight = window.innerHeight; + const min = 650; + const delta = windowHeight - min; + const factor = roundToNearestHalf(delta / 150); + + const head = document.querySelector("head"); + const style = document.createElement("style"); + style.innerText = `:root { --window-height-factor:${factor} }`; + head.appendChild(style); +} + +function roundToNearestHalf(num) { + return Math.round(num * 2) / 2; +} + +setWindowHeightFactor(); + document.addEventListener("DOMContentLoaded", () => { function toggleLogoState() { const scrollY = window.scrollY || window.pageYOffset; diff --git a/composer.json b/composer.json index 5ffded1..b490cfa 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,7 @@ }, "require": { "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "getkirby/cms": "^4.0", - "adrienpayet/front-comments": "^0.8.9" + "getkirby/cms": "^4.0" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index e95bb77..755dda1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,37 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4439e672d6e47d4b53afb46c041a4fd6", + "content-hash": "749a661738bcd5b9428c88a1da847bc7", "packages": [ - { - "name": "adrienpayet/front-comments", - "version": "0.8.9", - "source": { - "type": "git", - "url": "https://framagit.org/isUnknown/kirby-front-comments", - "reference": "cc9b03f63b02c0b461fbdbf419c224a96288abb1" - }, - "require": { - "getkirby/composer-installer": "^1.1" - }, - "type": "kirby-plugin", - "extra": { - "installer-name": "front-comments" - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Adrien Payet", - "email": "adrien.payet@outlook.com" - } - ], - "description": "Kirby plugin for adding comments anywhere in front-end pages.", - "homepage": "https://framagit.org/isUnknown/kirby-front-comments", - "time": "2024-03-09T14:04:18+00:00" - }, { "name": "christian-riesen/base32", "version": "1.6.0", diff --git a/site/blueprints/pages/blocks.yml b/site/blueprints/pages/grid.yml similarity index 75% rename from site/blueprints/pages/blocks.yml rename to site/blueprints/pages/grid.yml index 0d66478..f5bdef5 100644 --- a/site/blueprints/pages/blocks.yml +++ b/site/blueprints/pages/grid.yml @@ -1,7 +1,11 @@ -title: Blocs +title: Grille image: back: black -icon: bars + color: white +icon: dashboard +create: + fields: + - category tabs: contentTab: diff --git a/site/blueprints/pages/linear.yml b/site/blueprints/pages/linear.yml index 35b15b7..a9e13d5 100644 --- a/site/blueprints/pages/linear.yml +++ b/site/blueprints/pages/linear.yml @@ -1,6 +1,7 @@ title: Linéaire image: back: black + color: white icon: bars create: fields: diff --git a/site/blueprints/pages/year.yml b/site/blueprints/pages/year.yml index 5c84ef1..dd1fc5e 100644 --- a/site/blueprints/pages/year.yml +++ b/site/blueprints/pages/year.yml @@ -2,6 +2,7 @@ title: Année image: icon: calendar back: black + color: white columns: - width: 1/3 @@ -11,7 +12,7 @@ columns: type: pages templates: - linear - - blocks + - grid - width: 2/3 fields: edito: diff --git a/site/blueprints/tabs/meta.yml b/site/blueprints/tabs/meta.yml index 493b21b..35470d2 100644 --- a/site/blueprints/tabs/meta.yml +++ b/site/blueprints/tabs/meta.yml @@ -12,7 +12,8 @@ sections: label: Catégorie type: select options: query - query: site.categories.split + query: site.find('texts').categories.split + required: true width: 1/3 author: label: Auteur diff --git a/site/config/config.php b/site/config/config.php index c4c4c8b..d5a8489 100644 --- a/site/config/config.php +++ b/site/config/config.php @@ -1,84 +1,12 @@ true, 'panel' => [ - 'menu' => [ - 'site' => [ - 'label' => 'Accueil', - 'current' => function ($current) { - $path = Kirby::instance()->request()->path()->toString(); - return Str::contains($path, 'site'); - } - ], - 'texts' => [ - 'icon' => 'pen', - 'label' => 'Textes', - 'link' => 'pages/texts', - 'current' => function ($current) { - $path = Kirby::instance()->request()->path()->toString(); - return Str::contains($path, 'pages/texts'); - } - ], - '-', - '-', - 'infos' => [ - 'icon' => 'question', - 'label' => 'À propos', - 'link' => 'pages/a-propos', - 'current' => function ($current) { - $path = Kirby::instance()->request()->path()->toString(); - return Str::contains($path, 'pages/a-propos'); - } - ], - 'newsletter' => [ - 'icon' => 'email', - 'label' => 'Infolettre', - 'link' => 'pages/lettre', - 'current' => function ($current) { - $path = Kirby::instance()->request()->path()->toString(); - return Str::contains($path, 'pages/lettre'); - } - ], - '-', - '-', - 'users', - 'comments', - 'admin' => [ - 'icon' => 'folder', - 'label' => 'Administration', - 'link' => 'pages/admin', - 'current' => function ($current) { - $path = Kirby::instance()->request()->path()->toString(); - return Str::contains($path, 'pages/admin'); - } - ], - '-', - '-', - 'system', - ] - ], - 'routes' => [ - [ - 'pattern' => 'auteurs/(:any)', - 'action' => function ($slug) { - $kirby = kirby(); - $author = getAuthorBySlug($slug); - - return Page::factory([ - 'slug' => '', - 'template' => 'author', - 'model' => 'authors', - 'content' => [ - 'title' => $author->name(), - 'presentation' => $author->presentation(), - 'author' => $author->name(), - 'uuid' => Uuid::generate(), - ] - ]); - } - ] - ] + 'menu' => require __DIR__ . '/menu.php', + ], + 'routes' => [ + require __DIR__ . '/routes/virtual-author.php', + require __DIR__ . '/routes/virtual-category.php', + ] ]; diff --git a/site/config/menu.php b/site/config/menu.php new file mode 100644 index 0000000..be6edce --- /dev/null +++ b/site/config/menu.php @@ -0,0 +1,56 @@ + [ + 'label' => 'Accueil', + 'current' => function ($current) { + $path = Kirby::instance()->request()->path()->toString(); + return Str::contains($path, 'site'); + } + ], + 'texts' => [ + 'icon' => 'pen', + 'label' => 'Textes', + 'link' => 'pages/texts', + 'current' => function ($current) { + $path = Kirby::instance()->request()->path()->toString(); + return Str::contains($path, 'pages/texts'); + } + ], + '-', + '-', + 'infos' => [ + 'icon' => 'question', + 'label' => 'À propos', + 'link' => 'pages/a-propos', + 'current' => function ($current) { + $path = Kirby::instance()->request()->path()->toString(); + return Str::contains($path, 'pages/a-propos'); + } + ], + 'newsletter' => [ + 'icon' => 'email', + 'label' => 'Infolettre', + 'link' => 'pages/lettre', + 'current' => function ($current) { + $path = Kirby::instance()->request()->path()->toString(); + return Str::contains($path, 'pages/lettre'); + } + ], + '-', + '-', + 'users', + 'comments', + 'admin' => [ + 'icon' => 'folder', + 'label' => 'Administration', + 'link' => 'pages/admin', + 'current' => function ($current) { + $path = Kirby::instance()->request()->path()->toString(); + return Str::contains($path, 'pages/admin'); + } + ], + '-', + '-', + 'system', +]; diff --git a/site/config/routes/virtual-author.php b/site/config/routes/virtual-author.php new file mode 100644 index 0000000..0a067a1 --- /dev/null +++ b/site/config/routes/virtual-author.php @@ -0,0 +1,25 @@ + 'auteurs/(:any)', + 'action' => function ($slug) { + $kirby = kirby(); + $author = getAuthorBySlug($slug); + + return Page::factory( + [ + 'slug' => '', + 'template' => 'author', + 'model' => 'authors', + 'content' => [ + 'title' => $author->name(), + 'presentation' => $author->presentation(), + 'author' => $author->name(), + 'uuid' => Uuid::generate(), + ] + ] + ); + } +]; diff --git a/site/config/routes/virtual-category.php b/site/config/routes/virtual-category.php new file mode 100644 index 0000000..95b525c --- /dev/null +++ b/site/config/routes/virtual-category.php @@ -0,0 +1,22 @@ + 'categories/(:any)', + 'action' => function ($category) { + $kirby = kirby(); + + return Page::factory( + [ + 'slug' => '', + 'template' => 'category', + 'model' => 'categories', + 'content' => [ + 'title' => $category, + 'uuid' => Uuid::generate(), + ] + ] + ); + } +]; diff --git a/site/plugins/front-comments b/site/plugins/front-comments deleted file mode 160000 index cc9b03f..0000000 --- a/site/plugins/front-comments +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc9b03f63b02c0b461fbdbf419c224a96288abb1 diff --git a/site/snippets/header.php b/site/snippets/header.php index 73b9618..f0bd761 100644 --- a/site/snippets/header.php +++ b/site/snippets/header.php @@ -4,7 +4,7 @@ <?= $site->title() ?><?= e($page->url() !== $site->url(), '-' . $page->title()) ?> - + @@ -13,8 +13,8 @@
    \ No newline at end of file diff --git a/site/snippets/tabs.php b/site/snippets/tabs.php index 039f2e1..6909d09 100644 --- a/site/snippets/tabs.php +++ b/site/snippets/tabs.php @@ -1,5 +1,9 @@ @@ -11,11 +15,13 @@ $activeTab = isset($activeTab) ? Str::slug($activeTab) : '';
    - + + +
    children() as $article): ?> - author()->toUser()->name()->value()) : ?> -
  • - -

    title() ?>

    -
    -
    -

    - - par - author()->toUser()->name() ?>, - le - - published()->toDate('d/m/Y') ?> -

    -
    - -
  • + author()->toUser()->name()->value()) : ?> + $article + ] + ) ?> diff --git a/site/snippets/text-item.php b/site/snippets/text-item.php new file mode 100644 index 0000000..3aa060c --- /dev/null +++ b/site/snippets/text-item.php @@ -0,0 +1,13 @@ +
  • + +

    title() ?>

    +
    +
    +

    + par + author()->toUser()->name() ?>
    + publié le published()->toDate('d/m/Y') ?> + dans category() ?> +

    +
    +
  • \ No newline at end of file diff --git a/site/templates/author.php b/site/templates/author.php index 42c1026..191b8ed 100644 --- a/site/templates/author.php +++ b/site/templates/author.php @@ -4,7 +4,7 @@
    -

    title() ?>

    +

    title() ?>

    + +
    +
    + + +

    title() ?>

    +

    catégorie

    + + +
    +
      + collection('years') as $year): ?> + + +
      +

      title() ?>

      +
      + edito() ?> +
      + +
      + children() as $article): ?> + category() == $page->title()) : ?> + $article]) ?> + + + +
    +
    +
    +
    \ No newline at end of file diff --git a/site/templates/home.php b/site/templates/home.php index ee6580e..eb2ba14 100644 --- a/site/templates/home.php +++ b/site/templates/home.php @@ -3,10 +3,10 @@
    -

    - revue critique
    - des arts et des techniques
    -

    +

    + critique des arts
    + et des techniques
    +

    diff --git a/site/templates/linear.php b/site/templates/linear.php index c3d2fd4..416b48a 100644 --- a/site/templates/linear.php +++ b/site/templates/linear.php @@ -3,18 +3,19 @@