-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #2268 [Site] Isolate React/Svelte build (smnandre)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Site] Isolate React/Svelte build Ease the website install (no more JS needed) * group react source/build/dist files * group svelte source/build/dist files * remove root packages.json Also * rework the shared "PackageList" demo * clean the homepage FileTree Commits ------- 2cff156 [Site] Isolate React/Svelte build
- Loading branch information
Showing
34 changed files
with
175 additions
and
859 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
ux.symfony.com/assets/app-react.js → ux.symfony.com/assets/react/app-react.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {registerReactControllerComponents} from '@symfony/ux-react'; | ||
|
||
import './app.js'; | ||
import '../app.js'; | ||
|
||
registerReactControllerComponents(); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
ux.symfony.com/assets/react/src/components/PackageList.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
|
||
export default function (props) { | ||
if (props.packages.length === 0) { | ||
return 'No packages found'; | ||
} | ||
|
||
return ( | ||
props.packages.map(item => ( | ||
<div class="PackageListItem"> | ||
<div class="PackageListItem__icon" style={`--gradient: ${item.gradient}`}> | ||
<img src={item.imageUrl} alt={`Image for the ${item.humanName} UX package`} /> | ||
</div> | ||
<h3 class="PackageListItem__title"> | ||
<a href={item.url}>{item.humanName}</a> | ||
</h3> | ||
</div> | ||
)) | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"devDependencies": { | ||
"@babel/cli": "^7.25.6", | ||
"@babel/core": "^7.25.2", | ||
"@babel/preset-react": "^7.24.7" | ||
}, | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"build": "../build/node_modules/.bin/babel ../. --out-dir ../../build/react --presets=@babel/preset-react" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
.PackageList { | ||
--gradient: #202427; | ||
--color: #C8CED2; | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); | ||
gap: .75rem; | ||
} | ||
|
||
.PackageListItem { | ||
background: var(--bs-body-bg); | ||
border-radius: .75rem; | ||
border: 0.66px solid var(--bs-secondary-bg-subtle); | ||
padding: .5rem; | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-start; | ||
gap: .75rem; | ||
position: relative; | ||
} | ||
|
||
.PackageListItem__icon { | ||
width: 3rem; | ||
aspect-ratio: 1; | ||
border-radius: 14%; | ||
background: var(--gradient); | ||
display: grid; | ||
place-items: center; | ||
|
||
img { | ||
width: 100%; | ||
height: 100%; | ||
max-width: 50%; | ||
max-height: 50%; | ||
transition: transform 0.35s; | ||
.PackageListItem:hover & { | ||
transform: scale(1.05); | ||
} | ||
} | ||
} | ||
|
||
.PackageListItem__label { | ||
font-size: 1.25rem; | ||
font-family: var(--font-family-title); | ||
font-weight: 600; | ||
margin: 0; | ||
flex: 1; | ||
opacity: .85; | ||
transition: opacity 0.5s; | ||
letter-spacing: -0.07ch; | ||
|
||
.PackageListItem:hover & { | ||
opacity: 1; | ||
transition: opacity 0.25s; | ||
} | ||
|
||
a:after { | ||
content: " "; | ||
inset: 0; | ||
position: absolute; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
ux.symfony.com/assets/app-svelte.js → ux.symfony.com/assets/svelte/app-svelte.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {registerSvelteControllerComponents} from '@symfony/ux-svelte'; | ||
|
||
import './app.js'; | ||
import '../app.js'; | ||
|
||
registerSvelteControllerComponents(); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ux.symfony.com/assets/app-vue.js → ux.symfony.com/assets/vue/app-vue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {registerVueControllerComponents} from '@symfony/ux-vue'; | ||
|
||
import './app.js'; | ||
import '../app.js'; | ||
|
||
registerVueControllerComponents(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,21 @@ | ||
export default { | ||
props: ['packages'], | ||
template: ` | ||
<div> | ||
<div v-if="packages.length === 0" class="alert alert-info"> | ||
Sad trombone... we haven't built any components that match this search yet! | ||
<div v-if="packages.length === 0"> | ||
No packages found. Sad trombone... | ||
</div> | ||
<div v-else class="row"> | ||
<a | ||
v-for="uxPackage in packages" | ||
:href="uxPackage.url" | ||
class="col-12 col-md-4 col-lg-3 mb-2" | ||
> | ||
<div class="components-container p-2"> | ||
<div class="d-flex"> | ||
<div | ||
class="live-component-img d-flex justify-content-center align-items-center" | ||
:style="{background: uxPackage.gradient}"> | ||
<img width="17" height="17" | ||
:src="uxPackage.imageUrl" | ||
:alt="'Image for the ' + uxPackage.humanName + ' UX package'" | ||
/> | ||
</div> | ||
<h4 class="ubuntu-title ps-2 align-self-center"> | ||
{{ uxPackage.humanName }} | ||
</h4> | ||
<div v-else class="PackageList"> | ||
<div v-for="package in packages" class="PackageListItem"> | ||
<div class="PackageListItem__icon" :style="{'--gradient': package.gradient}"> | ||
<img :src="package.imageUrl" :alt="package.humanName"> | ||
</div> | ||
<h4 class="PackageListItem__label"> | ||
<a :href="package.url">{{ package.humanName }}</a> | ||
</h4> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
/** | ||
| Single-File Components - e.g. PackageSearch.vue - | ||
| are supported when using Webpack Encore. | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div class="FileTree FileTree-main list-unstyled px-3"> | ||
{{ _self.fileTree(files) }} | ||
</div> | ||
|
||
{% macro fileTree(files) %} | ||
{% for file_info in files %} | ||
<li class="FileTree-main {{ file_info.isDirectory ? 'FileTree-dir' : 'FileTree-file' }}"> | ||
<span | ||
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right" | ||
title="{{ file_info.description|e('html_attr') }}" | ||
> | ||
<twig:ux:icon name="{{ file_info.isDirectory ? 'folder-open' : 'file' }}" /> | ||
{{ file_info.filename }} | ||
</span> | ||
{% if file_info.files is defined %} | ||
<ul class="list-unstyled"> | ||
{{ _self.fileTree(file_info.files) }} | ||
</ul> | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
{% endmacro %} |
8 changes: 8 additions & 0 deletions
8
ux.symfony.com/templates/components/Package/PackageListItem.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="PackageListItem"> | ||
<div class="PackageListItem__icon" style="--gradient: {{ package.gradient }};"> | ||
<img src="{{ asset('images/ux_packages/' ~ package.imageFilename) }}" alt="Symfony UX {{ package.humanName }}" /> | ||
</div> | ||
<h4 class="PackageListItem__label"> | ||
<a href="{{ url(package.route) }}">{{ package.humanName }}</a> | ||
</h4> | ||
</div> |
25 changes: 10 additions & 15 deletions
25
ux.symfony.com/templates/components/Package/SearchPackages.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
<div{{ attributes }}> | ||
<input | ||
type="text" | ||
data-model="query" | ||
placeholder="Results update as you type..." | ||
class="form-control" | ||
> | ||
|
||
{% if computed.packages|length > 0 %} | ||
<div data-loading="addClass(opacity-50)" class="mt-3 row"> | ||
{% for package in computed.packages %} | ||
{{ include('main/_package_in_list.html.twig', {package}) }} | ||
{% endfor %} | ||
</div> | ||
{% else %} | ||
<div class="pt-3">Ah! No packages found matching "{{ query }}"</div> | ||
{% endif %} | ||
<input type="text" data-model="query" placeholder="Results update as you type..." class="form-control" /> | ||
|
||
<div class="PackageList pt-3" data-loading="addClass(opacity-50)"> | ||
{% for package in computed.packages %} | ||
{{ include('components/Package/PackageListItem.html.twig', {package}) }} | ||
{% else %} | ||
No packages found "{{ query }}" | ||
{% endfor %} | ||
</div> | ||
|
||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.