lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.ophir.dev
MIT License
882 stars 62 forks source link

adding css id to the contents in the text component #366

Closed amrutadotorg closed 1 month ago

amrutadotorg commented 1 month ago

Hi, I'm trying to add styling to the bold words in my text component. Do you think it is possible to add the CSS ID to the content so instead of:

.page-wrapper strong {
    background-color: #ff9800;
    font-weight: bold;
}

I could use for example:

#headline b {
    background-color: #ff9800; /* Orange */
    font-weight: bold;
}
SELECT 
    'text' AS component,
    'headline' as id;

SELECT post.id, 
       ts_headline('english', post.content, plainto_tsquery('english', $search), 'StartSel=**, StopSel=**') AS contents_md,
       translations.language_code
FROM post
JOIN translations ON translations.element_id = post.id
  AND translations.element_type = 'post_post'
  AND translations.language_code = 'en'
WHERE post.content_tsv @@ plainto_tsquery('english', $search);

Screenshot 2024-05-31 at 21 20 40

lovasoa commented 1 month ago

The text component already has an id attribute

amrutadotorg commented 1 month ago

related to #367