diff --git a/src/assets/css/wishlist.css b/src/assets/css/wish-card.css similarity index 50% rename from src/assets/css/wishlist.css rename to src/assets/css/wish-card.css index 8e507218..1aa6b2b4 100644 --- a/src/assets/css/wishlist.css +++ b/src/assets/css/wish-card.css @@ -1,50 +1,24 @@ -/** - * Wishlist Card - */ .wishlist .ui.card { --padding: 0.91666667em; --wishPreviewHeight: max(var(--wishPreviewHeightHover), var(--wishPreviewHeightMobile)); --wishPreviewHeightMobile: 192px; --wishPreviewHeightHover: calc(1em + 3 * var(--padding)); --wishPreviewHeightDifference: calc(var(--wishPreviewHeightMobile) - var(--wishPreviewHeightHover)); + + aspect-ratio: 1; } + .wishlist .ui.card:focus-within { z-index: calc(var(--dimmerZIndex) + 2); } -.wishlist .ui.card { - height: 100%; -} -.wishlist .ui.horizontal.card::before { - position: absolute; - right: 0; - left: 0; - bottom: 0; - - height: 4em; - width: 100%; - - content: ''; - border-radius: .28571429rem; - - background-image: linear-gradient(0deg, rgba(255, 255, 255, 1) 0.75em, rgba(255, 255, 255, 0.9) 45%, rgba(255, 255, 255, 0) 100%); -} -@media (prefers-color-scheme: dark) { - .wishlist .ui.horizontal.card::before { - background-image: linear-gradient(0deg, rgba(27, 28, 29, 1) 0.75em, rgba(27, 28, 29, 0.9) 45%, rgba(27, 28, 29, 0) 100%); - } -} .wishlist .ui.card.loading::before { height: 100%; } -.ui.card.horizontal, -.ui.horizontal.cards > .card { - flex-wrap: nowrap; - width: auto; -} - -/** Image */ +/** + * Image + */ .wishlist .ui.card > .image { --wishPreviewHeightMin: calc(1.28571429em * 1.28571429 + 2em + 3px); @@ -77,11 +51,29 @@ z-index: 1; border-radius: inherit; - background-image: linear-gradient(180deg, rgba(255, 255, 255, 1) 0, rgba(255, 255, 255, 0) 100%); + background-image: + linear-gradient(180deg, rgba(255, 255, 255, 1) 0, rgba(255, 255, 255, 0) 100%), + linear-gradient(0, rgba(255, 255, 255, 1) 0, rgba(255, 255, 255, 0) 100%); } @media (prefers-color-scheme: dark) { .wishlist .ui.card > .image::before { - background-image: linear-gradient(180deg, rgba(27, 28, 29, 1) 0, rgba(27, 28, 29, 0) 100%); + background-image: + linear-gradient(180deg, rgba(27, 28, 29, 0.8) 0, transparent 100%), + linear-gradient(0, rgba(27, 28, 29, 0.8) 0, transparent 100%); + } +} +@media (hover: hover) { + @media (prefers-reduced-motion: no-preference) { + .wishlist .ui.card > .image::before { + transition: 0.4s ease opacity; + } + } + .wishlist .ui.card > .image::before { + opacity: 0; + } + + .wishlist .ui.card:hover > .image::before { + opacity: 1; } } @@ -90,18 +82,8 @@ height: 100%; } -.wishlist .ui.horizontal.card > .image > :is(svg, img.preview) { - height: var(--wishPreviewHeightHover); -} -@media (hover: hover) { - .wishlist .ui.horizontal.card > .image > :is(svg, img.preview) { - height: var(--wishPreviewHeight); - } -} .wishlist .ui.card > .image > svg { - width: 100%; - color: #f0f0f0; background-color: #f4f4f4; @@ -133,10 +115,6 @@ 0.2s linear opacity; } } - .wishlist .ui.horizontal.card:hover > .image > svg { - padding: 0 !important; - opacity: 0; - } } .wishlist .ui.card > .image > img.preview { @@ -152,112 +130,18 @@ } } -.ui.card.horizontal > .image, -.ui.horizontal.cards > .card > .image { - --sizeFaviconX: calc(1.25em + var(--padding) * 2); - - width: min(var(--sizeFaviconX), var(--wishPreviewHeightMin)); -} -@media (max-width: 512px) { - .ui.card.horizontal > .image, - .ui.horizontal.cards > .card > .image { - display: none; - } -} - -/** Provider */ -.wishlist .ui.card > .image > img.favicon, -.wishlist .ui.card > .image > span.provider { - position: absolute; - top: 0; -} - -/** Favicon */ -.wishlist .ui.card > .image > img.favicon { - padding: calc(var(--padding) * 1.5) var(--padding); - - height: 1.25em; - width: auto; - - box-sizing: content-box; - z-index: 1; -} - -@media (prefers-color-scheme: dark) { - .wishlist .ui.card > .image > img.favicon { - filter: brightness(80%); - } -} - -.wishlist .ui.card > .image > img.favicon + span.provider { - padding-left: 3em; -} - -/** Provider name */ -.wishlist .ui.card > .image > span.provider { - display: block; - width: 100%; - padding: calc(var(--padding) * 1.5) var(--padding); - - line-height: 1; - user-select: none; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - background-color: rgba(255, 255, 255, 0.6); - backdrop-filter: blur(4px); -} - -@media (prefers-color-scheme: dark) { - .wishlist .ui.card > .image > span.provider { - background-color: rgba(0, 0, 0, 0.6); - } -} - -@supports (backdrop-filter: blur(4px)) { - .wishlist .ui.card > .image > span.provider { - background-color: rgba(255, 255, 255, 0.2); - backdrop-filter: blur(4px); - } - - @media (prefers-color-scheme: dark) { - .wishlist .ui.card > .image > span.provider { - background-color: rgba(0, 0, 0, 0.2); - } - } -} - -@media (hover: hover) { - .wishlist .ui.card > .image > span.provider { - position: absolute; - - opacity: 0; - } - - @media (prefers-reduced-motion: no-preference) { - .wishlist .ui.card > .image > span.provider { - transition: opacity 0.2s linear; - } - } - - .wishlist .ui.card:hover > .image > span.provider { - display: block; - - opacity: 1; - } -} - -/** Content */ +/** + * Content + */ .wishlist .ui.card > .content:not(.extra) { display: flex; - flex-direction: column; - align-items: flex-start; + flex-flow: column nowrap; gap: 0.5em; - width: 100%; + height: 100%; z-index: 1; + text-shadow: 0.02em 0.02em 0.12em #ddd; } @media (hover: hover) { @media (prefers-reduced-motion: no-preference) { @@ -267,13 +151,13 @@ 0.2s linear margin-bottom; } } - - .wishlist .ui.horizontal.card > .content:not(.extra) { - --contentHeight: calc(var(--wishPreviewHeightMobile) * 1.25); - - overflow: hidden; +} +@media (prefers-color-scheme: dark) { + .wishlist .ui.card > .content:not(.extra) { + text-shadow: 0.02em 0.02em 0.12em #222; } } + .ui.card > .content::after, .ui.cards > .card > .content::after { display: none; @@ -282,17 +166,9 @@ .wishlist .ui.card > .content > .header { flex-shrink: 0; - width: 100%; - white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - text-shadow: 0.02em 0.02em 0.12em #ddd; -} -@media (prefers-color-scheme: dark) { - .wishlist .ui.card > .content > .header { - text-shadow: 0.02em 0.02em 0.12em #222; - } } .wishlist .ui.card > .content > .header > .ui.label { @@ -305,41 +181,138 @@ text-shadow: none; } -.wishlist .ui.card > .content > .description { - margin-top: 0; - overflow: auto; +.wishlist .ui.card > .content > .header > .ui.small.label { + max-width: calc(0.78571429rem + 0.833em * 2); } -@media (max-width: 768px) { - .wishlist .ui.horizontal.card > .content > .description { - display: none; +@media (min-width: 768px) { + .wishlist .ui.card > .content > .header > .ui.label { + max-width: 100%; + } +} +@media (hover: hover) { + @media (prefers-reduced-motion: no-preference) { + .wishlist .ui.card > .content > .header > .ui.small.label { + transition: 0.4s ease max-width; + } + } + + .wishlist .ui.card > .content > .header > .ui.small.label { + max-width: 100%; + } + + .wishlist .ui.card:hover > .content > .header > .ui.label { + max-width: calc(0.78571429rem + 0.833em * 2); } } -/** Buttons */ -.wishlist .ui.card > .extra.buttons, -.wishlist .ui.card > .content > .extra.buttons { - position: relative; +.wishlist .ui.card > .content > .header > .ui.label > span { + opacity: 0; +} +@media (hover: hover) { + @media (prefers-reduced-motion: no-preference) { + .wishlist .ui.card > .content > .header > .ui.label > span { + transition: 0.4s ease opacity; + } + } - display: flex; - justify-content: flex-start; - align-items: center; - flex-flow: row wrap; - gap: 0.25em; - width: 100%; + .wishlist .ui.card > .content > .header > .ui.label > span { + opacity: 1; + } - background-color: inherit; - z-index: 2; + .wishlist .ui.card:hover > .content > .header > .ui.label > span { + opacity: 0; + } } -.wishlist .ui.card > .content > .extra.buttons { - flex-flow: row wrap; -} - -.wishlist .ui.card > .extra.buttons > .button, -.wishlist .ui.card > .content > .extra.buttons > .button { - margin: 0; +.wishlist .ui.card > .content > .description { + margin-top: 0; flex: 1 1 auto; + overflow: auto; +} + +.wishlist .ui.card > .content > .description > p { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +@media (hover: hover) { + .wishlist .ui.card:hover > .content > .description > p { + white-space: normal; + } +} + +/** Meta */ +.wishlist .ui.card .meta { + display: flex; + justify-content: space-between; +} + +.wishlist .ui.card .meta .favicon { + height: 1em; +} + +/** Buttons */ +.wishlist .ui.card > .content > .extra.buttons { + display: flex; + gap: 0.25em; + + margin-top: auto; +} +@media (hover: hover) { + @media (prefers-reduced-motion: no-preference) { + .wishlist .ui.card > .content > .extra.buttons { + transition: 0.2s ease opacity; + } + } + + .wishlist .ui.card > .content > .extra.buttons { + opacity: 0; + } + + .wishlist .ui.card > .content > .extra.buttons { + opacity: 1; + } +} +@media (min-width: 768px) { + .wishlist .ui.card > .content > .extra.buttons { + flex-wrap: wrap; + } +} + +.wishlist .ui.card > .content > .extra.buttons > .ui.button { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.wishlist .ui.card > .content > .extra.buttons > .ui.labeled.icon.button { + flex: 1 1 auto; + + margin: 0; +} +@media (max-width: 511.9px) { + .wishlist .ui.card > .content > .extra.buttons > .ui.labeled.icon.button { + padding: 0.589286em !important; + } +} + +.wishlist .ui.card > .content > .extra.buttons > .ui.labeled.icon.button > i.icon { + display: contents; +} +@media (min-width: 512px) { + .wishlist .ui.card > .content > .extra.buttons > .ui.labeled.icon.button > i.icon { + display: revert; + } +} + +.wishlist .ui.card > .content > .extra.buttons > .ui.labeled.icon.button > span { + display: none; +} +@media (min-width: 512px) { + .wishlist .ui.card > .content > .extra.buttons > .ui.labeled.icon.button > span { + display: revert; + } } /** Overlay */ diff --git a/src/assets/css/wish.css b/src/assets/css/wish.css deleted file mode 100644 index 54206b1d..00000000 --- a/src/assets/css/wish.css +++ /dev/null @@ -1,9 +0,0 @@ -.image.preview { - height: var(--wishPreviewHeight) !important; - - object-fit: cover; - object-position: 50%; - - background-color: #fff; - cursor: pointer; -} diff --git a/src/classes/wish.php b/src/classes/wish.php index f72f7b72..b5ff2e8b 100644 --- a/src/classes/wish.php +++ b/src/classes/wish.php @@ -147,11 +147,6 @@ class Wish
getCardPriority() ?> getCardContentHeader() ?> - - price) { ?> - getCardContentMeta($numberFormatter->format($this->price)) ?> - - getCardContentDescription() ?> getCardButtons($userIsCurrent) ?>
@@ -203,14 +198,32 @@ class Wish getCardContentHeader() ?> - price) { ?> - getCardContentMeta($numberFormatter->format($this->price)) ?> + getCardContentDescription() ?> + + info->favicon) || !empty($this->info->providerName) || $this->price) { ?> +
+ info->favicon) || !empty($this->info->providerName)) { ?> +
+ info->favicon)) { ?> + + + + info->providerName)) { ?> + info->providerName ?> + +
+ + + price) { ?> +
+ format($this->price) ?> +
+ +
- getCardContentDescription() ?> + getCardButtons($userIsCurrent) ?> - - getCardButtons($userIsCurrent) ?> - - info->favicon) && $this->info->favicon) { ?> - - - - info->providerName) && $this->info->providerName) { ?> - info->providerName ?> - description) { ?>
- description ?> +

description ?>

url && !$this->title) { ?>
- url ?> +

url ?>

priority && isset(self::$priorities[$this->priority])) { ?>
- priority]['name'] ?> + + priority]['name'] ?>
+
+ + + url) { ?> + + + + + +
+
getTitle()); -$wishlist_user = User::getFromID($wishlist->user); +$wishlist = new Wishlist($_GET['hash']); +$page = new Page(__FILE__, $wishlist->getTitle()); +$page->stylesheets[] = 'src/assets/css/wish-card.css'; +$wishlist_user = User::getFromID($wishlist->user); if (!$wishlist->exists) { $page->errorDocument(404, $wishlist); diff --git a/src/pages/wishlists.php b/src/pages/wishlists.php index 1b7ae1a4..3fe0e2ff 100644 --- a/src/pages/wishlists.php +++ b/src/pages/wishlists.php @@ -9,7 +9,7 @@ namespace wishthis; $page = new Page(__FILE__, __('My lists'), 1); -$page->stylesheets[] = 'src/assets/css/wishlist.css'; +$page->stylesheets[] = 'src/assets/css/wish-card.css'; $page->header(); $page->bodyStart(); $page->navigation();