diff --git a/assets/controllers/search_bar_controller.js b/assets/controllers/search_bar_controller.js
index e752f4c..dd94bd3 100644
--- a/assets/controllers/search_bar_controller.js
+++ b/assets/controllers/search_bar_controller.js
@@ -19,17 +19,36 @@ export default class extends Controller {
_onPreConnect(event) {
// TomSelect has not been initialized - options can be changed
- console.log(event.detail.options); // Options that will be used to initialize TomSelect
+ console.log(event.detail); // Options that will be used to initialize TomSelect
event.detail.options.onItemAdd = (value, $item) => {
- console.log(value, $item)
const params = value.split('|')
window.location.href = `/result/${params[0]}/${params[1]}`
};
+ event.detail.options.render.loading = (data, escape) => {
+ return `
+
+
+
+`;
+ }
+ event.detail.options.render.option = (data, escape) => {
+ if (data.data.description.length > 60) {
+ data.data.description = data.data.description.substring(0, 107) + "...";
+ }
+ return `
+

+
+
${data.data.title}
+
${data.data.description}
+
+
+`
+ }
}
_onConnect(event) {
// TomSelect has just been initialized and you can access details from the event
- console.log(event.detail.tomSelect); // TomSelect instance
- console.log(event.detail.options); // Options used to initialize TomSelect
+ // console.log(event.detail.tomSelect); // TomSelect instance
+ // console.log(event.detail.options); // Options used to initialize TomSelect
}
}
\ No newline at end of file
diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php
index dfc214d..e5651e1 100644
--- a/src/Controller/IndexController.php
+++ b/src/Controller/IndexController.php
@@ -44,6 +44,7 @@ final class IndexController extends AbstractController
foreach ($tmdbResults as $tmdbResult) {
/** @var TmdbResult $tmdbResult */
$results[] = [
+ 'data' => $tmdbResult,
'text' => $tmdbResult->title,
'value' => "$tmdbResult->mediaType|$tmdbResult->imdbId",
];
diff --git a/tailwind.config.js b/tailwind.config.js
index c5218d9..9a93414 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -5,6 +5,11 @@ module.exports = {
"./templates/**/*.html.twig",
],
safelist: [
+ "flex",
+ "flex-col",
+ "flex-row",
+ "p-2",
+ "p-4",
"bg-blue-300",
"bg-orange-300",
"bg-fuchsia-300",
@@ -22,7 +27,12 @@ module.exports = {
"ease-in",
"duration-700",
"opacity-100",
- "table-row"
+ "table-row",
+ "max-w-[60ch]",
+ "truncate",
+ "text-wrap",
+ "rounded-sm",
+ "rounded-md"
],
theme: {
extend: {