Skip to content

Commit 2f32a92

Browse files
committed
minor #1377 [Site] LiveMemory demo (smnandre)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Site] LiveMemory demo Ready to review :) Commits ------- 1c57719 [Site] LiveMemory demo
2 parents 1a4bdc0 + 1c57719 commit 2f32a92

File tree

115 files changed

+4423
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4423
-480
lines changed

ux.symfony.com/assets/controllers.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"@symfony/ux-turbo": {
8888
"turbo-core": {
8989
"enabled": true,
90-
"fetch": "eager"
90+
"fetch": "lazy"
9191
},
9292
"mercure-turbo-stream": {
9393
"enabled": true,
@@ -97,7 +97,7 @@
9797
"@symfony/ux-typed": {
9898
"typed": {
9999
"enabled": true,
100-
"fetch": "eager"
100+
"fetch": "lazy"
101101
}
102102
},
103103
"@symfony/ux-vue": {

ux.symfony.com/assets/controllers/bootstrap-modal-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Modal } from 'bootstrap';
1010
* See templates/components/BootstrapModal.html.twig to see how this is
1111
* attached to Bootstrap modal.
1212
*/
13+
/* stimulusFetch: 'lazy' */
1314
export default class extends Controller {
1415
modal = null;
1516

ux.symfony.com/assets/controllers/code-expander-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Controller } from '@hotwired/stimulus';
22

3+
/* stimulusFetch: 'lazy' */
34
export default class extends Controller {
45
static targets = ['useStatements', 'expandCodeButton', 'codeContent'];
56

ux.symfony.com/assets/controllers/code-highlighter-controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ hljs.registerLanguage('twig', hljs_twig);
1111
// xml is the language used for HTML
1212
hljs.registerLanguage('xml', hljs_xml);
1313

14+
15+
/* stimulusFetch: 'lazy' */
1416
export default class extends Controller {
1517
static targets = ['codeBlock'];
1618

ux.symfony.com/assets/controllers/markdown-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Controller } from '@hotwired/stimulus';
22
import snarkdown from 'snarkdown';
33

4+
/* stimulusFetch: 'lazy' */
45
export default class extends Controller {
56
static targets = ['input', 'preview'];
67

ux.symfony.com/assets/controllers/theme-switcher-controller.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@ export default class extends Controller {
88
}
99

1010
const theme = currentTheme === 'dark' ? 'light' : 'dark';
11+
12+
this.select(theme);
13+
}
14+
15+
select (theme) {
16+
clearTimeout(this.timeout);
17+
18+
this.element.setAttribute('data-switch', theme);
1119
localStorage.setItem('user-theme', theme);
12-
document.documentElement.setAttribute('data-bs-theme', theme);
20+
21+
this.timeout = setTimeout(() => {
22+
/**
23+
* Small delay to allow CSS transitions during theme switch.
24+
*/
25+
document.documentElement.setAttribute('data-bs-theme', theme);
26+
}, 250);
1327
}
1428
}

ux.symfony.com/assets/controllers/tooltips-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Controller } from '@hotwired/stimulus';
22
import { Tooltip } from 'bootstrap';
33

4+
/* stimulusFetch: 'lazy' */
45
export default class extends Controller {
56
connect() {
67
this.element.querySelectorAll('[data-bs-toggle="tooltip"]').forEach((element) => {

ux.symfony.com/assets/controllers/translator-demo-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function highlight({ code, language = 'javascript' }) {
2121
return hljs.highlight(code, { language }).value;
2222
}
2323

24+
/* stimulusFetch: 'lazy' */
2425
export default class extends Controller {
2526
static targets = [
2627
'helloCode',

ux.symfony.com/assets/controllers/ux-clipboard-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Clipboard from 'stimulus-clipboard'
22

3+
/* stimulusFetch: 'lazy' */
34
export default class extends Clipboard {
45
static values = {
56
source: String,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { startStimulusApp } from '@symfony/stimulus-bundle';
2+
3+
const app = startStimulusApp();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 7 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 4 additions & 0 deletions
-45.3 KB
-53.5 KB

ux.symfony.com/assets/styles/_images.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
filter: invert(100%) hue-rotate(180deg);
1616
}
1717
}
18+

ux.symfony.com/assets/styles/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
// Components
6666
@import "components/demo-container";
67+
@import "components/DemoCard";
6768
@import "components/DocsLink";
6869
@import "components/file_tree";
6970
@import "components/Icon";
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// -----------------------------------------------------------------
2+
// DemoCard
3+
// -----------------------------------------------------------------
4+
5+
.DemoCard {
6+
--radius: .75rem;
7+
position: relative;
8+
9+
display: flex;
10+
flex-direction: column;
11+
12+
border-radius: var(--radius);
13+
border: 1px solid var(--bs-secondary-bg-subtle);
14+
15+
transition: color 250ms ease-in-out, transform 750ms ease-in-out, box-shadow 750ms ease-in-out;
16+
transform: translateY(0);
17+
box-shadow: 0 0 0 transparent;
18+
}
19+
.DemoCard:hover {
20+
transition: color 250ms ease-in-out, transform 250ms ease-in-out, box-shadow 250ms ease-in-out;
21+
transform: translateY(-.25rem);
22+
box-shadow: 0 0.125rem 2rem .25rem var(--bs-secondary-bg-subtle);
23+
}
24+
25+
.DemoCard__badge {
26+
position: absolute;
27+
right: .75rem;
28+
top: .75rem;
29+
color: var(--bs-body-color);
30+
padding: .25rem;
31+
font-size: .8rem;
32+
text-transform: initial;
33+
background: linear-gradient(113.84deg, #D65831 0%, #D2D631 36.52%, #31D673 71.83%, #3aa3ff 100%);
34+
background: var(--gradient);
35+
border-radius: 50%;
36+
animation: linear 2000s infinite alternate;
37+
}
38+
@keyframes badge--rotation {
39+
0% {
40+
transform: rotate(0deg)
41+
}
42+
100% {
43+
transform: rotate(180deg)
44+
}
45+
}
46+
47+
.DemoCard__media {
48+
border-top-left-radius: var(--radius);
49+
border-top-right-radius: var(--radius);
50+
display: grid;
51+
width: 100%;
52+
min-height: 100px;
53+
aspect-ratio: 16 / 9;
54+
overflow: hidden;
55+
place-content: center;
56+
background: #000;
57+
}
58+
59+
.DemoCard__image {
60+
max-height: 100%;
61+
width: 100%;
62+
display: block;
63+
transition: transform 500ms linear;
64+
transform: scale(1) translateY(0);
65+
border-radius: .25rem;
66+
transform-style: preserve-3d;
67+
opacity: .80;
68+
}
69+
.DemoCard:hover .DemoCard__image {
70+
opacity: .90;
71+
}
72+
73+
.DemoCard__content {
74+
padding: .75rem 1rem;
75+
flex: 1;
76+
border-bottom-left-radius: var(--radius);
77+
border-bottom-right-radius: var(--radius);
78+
gap: .5rem;
79+
display: flex;
80+
flex-direction: column;
81+
}
82+
83+
.DemoCard__title {
84+
font-size: 1.1rem;
85+
font-weight: 700;
86+
margin: 0;
87+
font-family: var(--font-family-title);
88+
padding: .25rem;
89+
}
90+
91+
.DemoCard__description {
92+
font-size: 0.9rem;
93+
font-stretch: semi-condensed;
94+
font-weight: 400;
95+
transition: all 250ms ease-in-out;
96+
opacity: .65;
97+
line-height: 1.4;
98+
padding: .25rem;
99+
margin: 0;
100+
}
101+
.DemoCard:hover .DemoCard__description {
102+
opacity: .85;
103+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// -----------------------------------------------------------------
2+
// LiveMemory demo custom stylesheets
3+
// -----------------------------------------------------------------
4+
5+
@layer root, base, layout, component, utilities;
6+
7+
@layer root {
8+
// Reset, variables & core styles
9+
@import "live-memory/app/reset";
10+
@import "live-memory/app/root";
11+
@import "live-memory/app/html";
12+
}
13+
14+
@layer base {
15+
@import "live-memory/base/header";
16+
}
17+
18+
@layer components {
19+
@import "../components/Icon";
20+
@import "live-memory/components/Board";
21+
@import "live-memory/components/Card";
22+
@import "live-memory/components/Debug";
23+
@import "live-memory/components/Logo";
24+
@import "live-memory/components/Metric";
25+
@import "live-memory/components/Overlay";
26+
@import "live-memory/components/Score";
27+
@import "live-memory/components/ThemeSwitch";
28+
@import "live-memory/components/Timer";
29+
}
30+
31+
@layer utilities {
32+
@import "../utilities/background";
33+
@import "../utilities/shadow";
34+
}
35+
36+
@layer theme {
37+
@import "live-memory/app/themes";
38+
}

0 commit comments

Comments
 (0)