Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TO - Additional Info Read More JS #457

Merged
merged 4 commits into from
Dec 12, 2024
Merged

Conversation

Justinabes007
Copy link
Contributor

@Justinabes007 Justinabes007 commented Dec 12, 2024

Summary of Changes:

  • Additional Info Read More JS: Added functionality for expanding additional information sections with a "Read More" toggle.
  • CSS Styling Fixes: Updated the styling for a slider block, improving visual consistency and accessibility.
  • Arrow Icon Update: Replaced arrow icons with new dark-themed SVGs (left-arrow-dark.svg and right-arrow-dark.svg).
  • Layout Enhancements: Adjusted the slider layout to improve visual appeal and interaction on various screen sizes.
  • Performance: Minor optimizations to the slider's appearance and behavior on mobile and desktop.

Summary by CodeRabbit


  • New Feature: Added "Read More" functionality to truncate long content sections, improving readability and user experience.
  • Style: Updated the visual layout of the slider block for better appeal, including new SVG arrow icons and optimized appearance on mobile and desktop.
  • Style: Introduced specific styles for additional information sections, fast facts, and facilities list, enhancing readability and interaction.
  • Style: Improved slick slider arrows and lightbox styles for visual consistency.
  • Style: Adjusted CSS styling for elements like fast facts, facilities list, additional info, and slider components for improved visual consistency and accessibility across different screen sizes.

Styling fixes to slider Block

Additional Info Read More JS
@Justinabes007 Justinabes007 added [Type] Enhancement A suggestion for improvement [Status] Needs Review Pull request needing a review [Dev] CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Tours Tours post type related issues and PRs labels Dec 12, 2024
@Justinabes007 Justinabes007 added this to the 2.1.0 milestone Dec 12, 2024
@Justinabes007 Justinabes007 self-assigned this Dec 12, 2024
Copy link

coderabbitai bot commented Dec 12, 2024

Warning

CodeRabbit GitHub Action detected

The repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action.

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Dec 12, 2024

Image description CodeRabbit

Walkthrough

This update introduces enhancements to the user interface, improving readability and interaction. Changes include a "Read More" toggle for long content sections, visual upgrades to the slider block, and new styles for additional information sections. The code also sees performance optimizations and layout adjustments for better mobile and desktop experiences.

Changes

Files Summary
assets/css/style.css, assets/css/style.scss, assets/js/src/custom.js Added functionality for expanding additional information sections and truncating paragraphs with a "Read More" button. Slider block styling updated with new SVGs for arrow icons and layout enhancements.
assets/css/scss/_additional.scss Introduced specific styles for additional information sections, fast facts, facilities list, and read more/less buttons. Includes styling adjustments for icons, text alignment, word wrapping, and visual enhancements.
assets/css/scss/_slider.scss Significant changes to the styling of the slick slider arrows, lightbox styles, and additional slider styles. New SVG icons for the arrows introduced and various CSS properties related to the slider components updated.

🎉🐇

With each pull request, we grow,

In our codebase, improvements show.

From "Read More" toggles, to sliders so sleek,

For better UX, it's these tweaks we seek.

So here's to the devs, working night and day,

Making sure our app, is more than okay! 🎉🐇


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between b19e63e and 3fe9116 commits.
Files selected (2)
  • assets/css/style.css (2)
  • assets/js/src/custom.js (1)
Files ignored due to filter (2)
  • assets/img/left-arrow-dark.svg
  • assets/img/right-arrow-dark.svg
Review comments generated (7)
  • Review: 2
  • LGTM: 5

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines 352 to 372
.facilities-list li::marker{display:none;}
.facilities-list{padding-left:0!important;}

.facilities-list li {
margin-left: 10px;
list-style: none; /* Remove default list marker */
position: relative; /* Position for pseudo-element */}

.facilities-list li::before{
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%); /* Center the icon vertically */
width: 20px; /* Adjust the size of the tick icon */
height: 20px;
background-image: url('../img/tick.svg'); /* Replace with the path to your tick.svg */
background-size: contain;
background-repeat: no-repeat;
left:-28px
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

There is a minor issue with the CSS property left being declared twice for .facilities-list li::before. The second declaration will override the first one. If this is not intentional, you should remove the redundant declaration.

.facilities-list li::before{
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%); /* Center the icon vertically */
    width: 20px; /* Adjust the size of the tick icon */
    height: 20px;
    background-image: url('../img/tick.svg'); /* Replace with the path to your tick.svg */
    background-size: contain;
    background-repeat: no-repeat;
-371:     left:-28px
+371:     /* left:-28px */ // Commented out as it seems to be a duplicate
}

Comment on lines +316 to +350
paragraphs.forEach(function (p) {
const text = p.innerText.trim();

if (text.split(' ').length > 30) { // Check if paragraph exceeds 30 words
const fullText = p.innerText.trim();
const truncatedText = fullText.split(' ').slice(0, 30).join(' ') + '...';
p.innerHTML = `<span class="truncated-text">${truncatedText}</span><span class="full-text" style="display: none;">${fullText}</span>`;

// Create Read More button
const readMoreBtn = document.createElement('span');
readMoreBtn.textContent = ' Read More';
readMoreBtn.classList.add('read-more-btn');
p.appendChild(readMoreBtn);

// Create Read Less button
const readLessBtn = document.createElement('span');
readLessBtn.textContent = ' Read Less';
readLessBtn.classList.add('read-less-btn');
p.appendChild(readLessBtn);

// Add functionality to toggle text
readMoreBtn.addEventListener('click', function () {
p.querySelector('.truncated-text').style.display = 'none';
p.querySelector('.full-text').style.display = 'inline';
readMoreBtn.style.display = 'none';
readLessBtn.style.display = 'inline';
});

readLessBtn.addEventListener('click', function () {
p.querySelector('.truncated-text').style.display = 'inline';
p.querySelector('.full-text').style.display = 'none';
readMoreBtn.style.display = 'inline';
readLessBtn.style.display = 'none';
});
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The logic for creating "Read More" and "Read Less" buttons is directly manipulating the DOM inside a loop. This could lead to performance issues if there are many paragraphs on the page. It would be more efficient to use event delegation, where you attach an event listener to a parent element and handle events from its child elements based on the event's target.

Here's how you can refactor this code:

- paragraphs.forEach(function (p) {
-    const text = p.innerText.trim();
-    if (text.split(' ').length > 30) {  // Check if paragraph exceeds 30 words
-        const fullText = p.innerText.trim();
-        const truncatedText = fullText.split(' ').slice(0, 30).join(' ') + '...';
-        p.innerHTML = `<span class="truncated-text">${truncatedText}</span><span class="full-text" style="display: none;">${fullText}</span>`;
-
-        // Create Read More button
-        const readMoreBtn = document.createElement('span');
-        readMoreBtn.textContent = ' Read More';
-        readMoreBtn.classList.add('read-more-btn');
-        p.appendChild(readMoreBtn);
-
-        // Create Read Less button
-        const readLessBtn = document.createElement('span');
-        readLessBtn.textContent = ' Read Less';
-        readLessBtn.classList.add('read-less-btn');
-        p.appendChild(readLessBtn);
-
-        // Add functionality to toggle text
-        readMoreBtn.addEventListener('click', function () {
-            p.querySelector('.truncated-text').style.display = 'none';
-            p.querySelector('.full-text').style.display = 'inline';
-            readMoreBtn.style.display = 'none';
-            readLessBtn.style.display = 'inline';
-        });
-
-        readLessBtn.addEventListener('click', function () {
-            p.querySelector('.truncated-text').style.display = 'inline';
-            p.querySelector('.full-text').style.display = 'none';
-            readMoreBtn.style.display = 'inline';
-            readLessBtn.style.display = 'none';
-        });
-    }
-});
+ document.querySelector('.additional-info .wp-block-group.content').addEventListener('click', function (event) {
+     if (event.target.matches('.read-more-btn')) {
+         const p = event.target.parentNode;
+         p.querySelector('.truncated-text').style.display = 'none';
+         p.querySelector('.full-text').style.display = 'inline';
+         p.querySelector('.read-more-btn').style.display = 'none';
+         p.querySelector('.read-less-btn').style.display = 'inline';
+     } else if (event.target.matches('.read-less-btn')) {
+         const p = event.target.parentNode;
+         p.querySelector('.truncated-text').style.display = 'inline';
+         p.querySelector('.full-text').style.display = 'none';
+         p.querySelector('.read-more-btn').style.display = 'inline';
+         p.querySelector('.read-less-btn').style.display = 'none';
+     }
+ });

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 3fe9116 and 7fa4557 commits.
Files selected (2)
  • assets/css/style.scss (1)
  • assets/js/src/custom.js (3)
Files skipped from review due to trivial changes (1)
  • assets/css/style.scss
Review comments generated (4)
  • Review: 4
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@@ -208,7 +208,7 @@ if ( window.location.hash ) {
draggable: false,
infinite: true,
swipe: false,
dots: true,
dots: false,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The change from dots: true to dots: false disables the display of dots for navigation in the slider. If this is intentional and aligns with the design requirements, then it's fine. However, if you still need the dots for navigation, you should revert this change.

- dots: false,
+ dots: true,

Comment on lines +220 to +238
breakpoint: 1028,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
draggable: false,
arrows: true,
swipe: false,
draggable: true,
arrows: false,
swipe: true,
dots: true,
}
},
{
breakpoint: lsx_to_params.slickSlider.mobile.breakpoint,
breakpoint: 782,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
draggable: true,
arrows: false,
swipe: true,
dots: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The changes made here are mostly related to responsive design. The breakpoints have been changed and some settings have been altered for different screen sizes. As long as these changes align with your design requirements and have been tested across different devices and screen sizes, they look good.

Comment on lines +315 to +354
document.addEventListener('DOMContentLoaded', function () {
const paragraphs = document.querySelectorAll('.additional-info .wp-block-group.content p');

paragraphs.forEach(function (p) {
const text = p.innerText.trim();

if (text.split(' ').length > 30) { // Check if paragraph exceeds 30 words
const fullText = p.innerText.trim();
const truncatedText = fullText.split(' ').slice(0, 30).join(' ') + '...';
p.innerHTML = `<span class="truncated-text">${truncatedText}</span><span class="full-text" style="display: none;">${fullText}</span>`;

// Create Read More button
const readMoreBtn = document.createElement('span');
readMoreBtn.textContent = ' Read More';
readMoreBtn.classList.add('read-more-btn');
p.appendChild(readMoreBtn);

// Create Read Less button
const readLessBtn = document.createElement('span');
readLessBtn.textContent = ' Read Less';
readLessBtn.classList.add('read-less-btn');
p.appendChild(readLessBtn);

// Add functionality to toggle text
readMoreBtn.addEventListener('click', function () {
p.querySelector('.truncated-text').style.display = 'none';
p.querySelector('.full-text').style.display = 'inline';
readMoreBtn.style.display = 'none';
readLessBtn.style.display = 'inline';
});

readLessBtn.addEventListener('click', function () {
p.querySelector('.truncated-text').style.display = 'inline';
p.querySelector('.full-text').style.display = 'none';
readMoreBtn.style.display = 'inline';
readLessBtn.style.display = 'none';
});
}
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

This new code block adds a "Read More" / "Read Less" functionality to paragraphs that exceed 30 words. It seems to be well implemented, creating two buttons and toggling visibility between the truncated and full text versions of the paragraph. However, there are a few points to consider:

  1. Performance: Querying the DOM and manipulating it inside a loop can be costly in terms of performance. Consider using DocumentFragment to minimize reflows and repaints.

  2. Accessibility: Ensure that the 'Read More' and 'Read Less' buttons are accessible, i.e., can be tabbed to and activated using keyboard only. You might want to use <button> elements instead of <span> for better semantics and built-in accessibility features.

  3. Security: Directly injecting text into HTML using innerHTML can expose your site to Cross-Site Scripting (XSS) attacks if the text content is user-supplied or can be manipulated by users. If the text content is static and cannot be manipulated by users, this isn't an issue.

Here's a revised version of the code considering these points:

document.addEventListener('DOMContentLoaded', function () {
    const paragraphs = document.querySelectorAll('.additional-info .wp-block-group.content p');
    const fragment = document.createDocumentFragment();

    paragraphs.forEach(function (p) {
        const text = p.innerText.trim();

        if (text.split(' ').length > 30) {  // Check if paragraph exceeds 30 words
            const fullText = p.innerText.trim();
            const truncatedText = fullText.split(' ').slice(0, 30).join(' ') + '...';
            p.textContent = '';

            const truncatedSpan = document.createElement('span');
            truncatedSpan.className = 'truncated-text';
            truncatedSpan.textContent = truncatedText;

            const fullTextSpan = document.createElement('span');
            fullTextSpan.className = 'full-text';
            fullTextSpan.style.display = 'none';
            fullTextSpan.textContent = fullText;

            const readMoreBtn = document.createElement('button');
            readMoreBtn.textContent = ' Read More';
            readMoreBtn.classList.add('read-more-btn');

            const readLessBtn = document.createElement('button');
            readLessBtn.textContent = ' Read Less';
            readLessBtn.classList.add('read-less-btn');
            readLessBtn.style.display = 'none';

            readMoreBtn.addEventListener('click', function () {
                truncatedSpan.style.display = 'none';
                fullTextSpan.style.display = 'inline';
                readMoreBtn.style.display = 'none';
                readLessBtn.style.display = 'inline';
            });

            readLessBtn.addEventListener('click', function () {
                truncatedSpan.style.display = 'inline';
                fullTextSpan.style.display = 'none';
                readMoreBtn.style.display = 'inline';
                readLessBtn.style.display = 'none';
            });

            fragment.appendChild(truncatedSpan);
            fragment.appendChild(fullTextSpan);
            fragment.appendChild(readMoreBtn);
            fragment.appendChild(readLessBtn);

            p.appendChild(fragment);
        }
    });
});

});
});

} )( jQuery, window, document );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The absence of a newline at the end of a file can cause issues with some tools that expect or require it. It's generally considered good practice to always end a file with a newline.

- } )( jQuery, window, document );
+ } )( jQuery, window, document );
+

Copy link
Collaborator

@krugazul krugazul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please copy your code changes into the 2 relevant files, slider changes here.
https://github.com/lightspeedwp/tour-operator/blob/additional-info-read-more/assets/css/scss/_slider.scss

and ive added another files for anything else like the fast facts and facilities css.
https://github.com/lightspeedwp/tour-operator/blob/additional-info-read-more/assets/css/scss/_additional.scss

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 7fa4557 and ccabb3a commits.
Files selected (2)
  • assets/css/scss/_additional.scss (1)
  • assets/css/scss/_slider.scss (1)
Review comments generated (6)
  • Review: 2
  • LGTM: 4

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines 67 to 91
.slick-dots:not(.dropdown-menu) {
align-items: center;
display: flex;
flex-flow: row wrap;
height: auto;
justify-content: center;
list-style: none;
margin: 2rem 0 0;
padding: 0;

& > li {
line-height: 1;
padding: 5px;

& > button {
background: transparent;
border-style: solid;
border-width: 1px;
font: 0/0 a;
height: 12px;
transition: all 300ms ease-in-out;
width: 4rem;
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The styling for .slick-dots:not(.dropdown-menu) and its child elements seems to be repeated at lines 194-217. This repetition increases the file size and makes the code harder to maintain. Consider removing the duplicate code.

-   .slick-dots:not(.dropdown-menu) {
-     align-items: center;
-     display: flex;
-     flex-flow: row wrap;
-     height: auto;
-     justify-content: center;
-     list-style: none;
-     margin: 2rem 0 0;
-     padding: 0;
- 
-     & > li {
-       line-height: 1;
-       padding: 5px;
- 
-       & > button {
-         background: transparent;
-         border-style: solid;
-         border-width: 1px;
-         font: 0/0 a;
-         height: 12px;
-         transition: all 300ms ease-in-out;
-         width: 4rem;
-       }
-     }
-   }

Comment on lines 126 to 231
.wp-block-query.lsx-to-slider{
.slick-arrow {
background: transparent;
border-radius: 50%;
position: absolute;
top: 50%;
border-style: solid;
border-color: #fff;
border-width: 2px;
font: 0/0 a;
height: 4rem;
margin-top: calc((2.25rem - 17px) / 2);
padding: 0;
text-shadow: none;
transform: translateY(-50%);
transition: border 300ms ease;
width: 4rem;
z-index: 3;
color: white;

&:before {
display: block;
font-family: "slick";
color: white;
font-size: 3rem;
line-height: 1;
position: absolute;
text-rendering: auto;
top: 47%;
transform: translateY(-50%);
transition: color 300ms ease;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

&.slick-disabled {
cursor: not-allowed;
}

&.slick-prev {
&:before {
content: ''; /* Remove font icon */
background: url('../../img/left-arrow-new.svg') no-repeat center center;
width: 40px;
height: 40px;
display: inline-block;
left: 10px;
}
}

&.slick-next {
&:before {
content: ''; /* Remove font icon */
background: url('../../img/right-arrow.svg') no-repeat center center;
width: 40px;
height: 40px;
display: inline-block;
left: 12px;
}
}
}

.slick-dots:not(.dropdown-menu) {
align-items: center;
display: flex;
flex-flow: row wrap;
height: auto;
justify-content: center;
list-style: none;
margin: 2rem 0 0;
padding: 0;

& > li {
line-height: 1;
padding: 5px;

& > button {
background: transparent;
border-style: solid;
border-width: 1px;
font: 0/0 a;
height: 12px;
transition: all 300ms ease-in-out;
width: 4rem;
}
}
}

.slick-arrow {
&.slick-prev {
left: -4rem;
}
&.slick-next {
right: -4rem;
}
}

&.slider-disabled {
overflow: hidden;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The styling for .wp-block-query.lsx-to-slider and its child elements is identical to the styling for .lsx-to-slider, .slick-lightbox-inner and its child elements (lines 4-66). This repetition increases the file size and makes the code harder to maintain. Consider using a single selector that matches both cases.

- /* Slick Slider Arrows and Lightbox styles */
- .wp-block-query.lsx-to-slider{
-   .slick-arrow {
-     background: transparent;
-     border-radius: 50%;
-     position: absolute;
-     top: 50%;
-     border-style: solid;
-     border-color: #fff;
-     border-width: 2px;
-     font: 0/0 a;
-     height: 4rem;
-     margin-top: calc((2.25rem - 17px) / 2);
-     padding: 0;
-     text-shadow: none;
-     transform: translateY(-50%);
-     transition: border 300ms ease;
-     width: 4rem;
-     z-index: 3;
-     color: white;
- 
-     &:before {
-       display: block;
-       font-family: "slick";
-       color: white;
-       font-size: 3rem;
-       line-height: 1;
-       position: absolute;
-       text-rendering: auto;
-       top: 47%;
-       transform: translateY(-50%);
-       transition: color 300ms ease;
-       -webkit-font-smoothing: antialiased;
-       -moz-osx-font-smoothing: grayscale;
-     }
- 
-     &.slick-disabled {
-       cursor: not-allowed;
-     }
- 
-     &.slick-prev {
-       &:before {
-         content: ''; /* Remove font icon */
-         background: url('../../img/left-arrow-new.svg') no-repeat center center;
-         width: 40px;
-         height: 40px;
-         display: inline-block;
-         left: 10px;
-       }
-     }
- 
-     &.slick-next {
-       &:before {
-         content: ''; /* Remove font icon */
-         background: url('../../img/right-arrow.svg') no-repeat center center;
-         width: 40px;
-         height: 40px;
-         display: inline-block;
-         left: 12px;
-       }
-     }
-   }
- 
-   .slick-dots:not(.dropdown-menu) {
-     align-items: center;
-     display: flex;
-     flex-flow: row wrap;
-     height: auto;
-     justify-content: center;
-     list-style: none;
-     margin: 2rem 0 0;
-     padding: 0;
- 
-     & > li {
-       line-height: 1;
-       padding: 5px;
- 
-       & > button {
-         background: transparent;
-         border-style: solid;
-         border-width: 1px;
-         font: 0/0 a;
-         height: 12px;
-         transition: all 300ms ease-in-out;
-         width: 4rem;
-       }
-     }
-   }
- 
-   .slick-arrow {
-     &.slick-prev {
-       left: -4rem;
-     }
-     &.slick-next {
-       right: -4rem;
-     }
-   }
- 
-   &.slider-disabled {
-     overflow: hidden;
-   }
- }

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between ccabb3a and 14d62aa commits.
Files selected (3)
  • assets/css/scss/_slider.scss (1)
  • assets/css/style.css (6)
  • assets/css/style.scss (1)
Files skipped from review due to trivial changes (1)
  • assets/css/style.scss
Review comments generated (25)
  • Review: 7
  • LGTM: 18

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines +6 to 31
.slick-arrow {
cursor: pointer;
border-color: #000 !important;
height: 30px;
width: 30px;

.lsx-to-slider,
.slick-lightbox-inner {
.slick-arrow {
background: transparent;
border-radius: 50%;
border-style: solid;
border-width: 2px;
font: 0/0 a;
height: 4rem;
margin-top: calc((2.25rem - 17px) / 2);
padding: 0;
text-shadow: none;
transform: translateY(-50%);
transition: border 300ms ease;
width: 4rem;
z-index: 3;

&:before {
display: block;
font-family: 'FontAwesome';
font-size: 3rem;
line-height: 1;
position: absolute;
text-rendering: auto;
top: 47%;
transform: translateY(-50%);
transition: color 300ms ease;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
&:before {
border-color: #000 !important;
height: 30px;
width: 30px;
}

&.slick-disabled { cursor: not-allowed; }
&.slick-prev:before {
background: url('../img/left-arrow-dark.svg') no-repeat center center;
width: 20px;
left: 3px;
height: 20px;
}

&.slick-prev {
&:before {
content: '\f104';
left: 1.1rem;
&.slick-next:before {
background: url('../img/right-arrow-dark.svg') no-repeat center center;
width: 20px;
left: 3px;
height: 20px;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The use of !important in CSS is generally discouraged as it breaks the natural cascading in your stylesheets. It's better to increase specificity of the selector or rethink your class structure instead.

-8: 			border-color: #000 !important;
-13: 				border-color: #000 !important;

+8: 			border-color: #000;
+13: 				border-color: #000;

Comment on lines +48 to +83
.lsx-to-slider,
.slick-lightbox-inner {
.slick-arrow {
background: transparent;
border-radius: 50%;
position: absolute;
top: 50%;
border-style: solid;
border-color: #fff;
border-width: 2px;
font: 0/0 a;
height: 4rem;
margin-top: calc((2.25rem - 17px) / 2);
padding: 0;
text-shadow: none;
transform: translateY(-50%);
transition: border 300ms ease;
width: 4rem;
z-index: 3;
color: white;

&:before {
display: block;
font-family: "slick";
color: white;
font-size: 3rem;
line-height: 1;
position: absolute;
text-rendering: auto;
top: 47%;
transform: translateY(-50%);
transition: color 300ms ease;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The use of !important in CSS is generally discouraged as it breaks the natural cascading in your stylesheets. It's better to increase specificity of the selector or rethink your class structure instead.

-34: 			padding: 15px !important;

+34: 			padding: 15px;

Comment on lines +91 to +117
.lsx-to-slider,
.slick-lightbox-inner {
.slick-arrow {
&.slick-disabled {
cursor: not-allowed;
}

&.slick-prev {
&:before {
content: ''; /* Remove font icon */
width: 40px;
height: 40px;
display: inline-block;
left: 10px;
}
}

&.slick-next {
&:before {
content: ''; /* Remove font icon */
width: 40px;
height: 40px;
display: inline-block;
left: 12px;
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The use of content: ''; /* Remove font icon */ seems to be a workaround for removing the font icon. If you don't want to display the content, consider using a different approach such as changing the visibility or display property.

Comment on lines +211 to +237
.facilities-list li::marker {
display: none;
}

.facilities-list {
padding-left: 0 !important;
}

.facilities-list li {
margin-left: 10px;
list-style: none; /* Remove default list marker */
position: relative; /* Position for pseudo-element */
}

.facilities-list li::before {
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%); /* Center the icon vertically */
width: 20px; /* Adjust the size of the tick icon */
height: 20px;
background-image: url("../../img/tick.svg"); /* Replace with the path to your tick.svg */
background-size: contain;
background-repeat: no-repeat;
left: -28px;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The path to the tick.svg file is hardcoded. This could lead to issues if the file structure changes or if the CSS file is used in a different context where the relative path is different. Consider making this path configurable or absolute.

-   background-image: url("../../img/tick.svg"); /* Replace with the path to your tick.svg */
+   background-image: var(--tick-icon-path, url("../../img/tick.svg")); /* Replace with the path to your tick.svg */

Comment on lines +329 to +353

.slick-prev svg,
.slick-next svg {
color: white;
}

.lsx-to-slider .slick-arrow.slick-disabled,
.slick-lightbox-inner .slick-arrow.slick-disabled {
cursor: not-allowed;
}
.lsx-to-slider .slick-arrow.slick-prev:before,
.slick-lightbox-inner .slick-arrow.slick-prev:before {
content: ''; /* Remove font icon */
background: url('../img/left-arrow-new.svg') no-repeat center center;
width: 40px;
height: 40px;
display: inline-block;
left: 10px;
content: ""; /* Remove font icon */
width: 40px;
height: 40px;
display: inline-block;
left: 10px;
}
.lsx-to-slider .slick-arrow.slick-next:before,
.slick-lightbox-inner .slick-arrow.slick-next:before {
content: ''; /* Remove font icon */
background: url('../img/right-arrow.svg') no-repeat center center;
width: 40px;
height: 40px;
display: inline-block;
left: 12px;
content: ""; /* Remove font icon */
width: 40px;
height: 40px;
display: inline-block;
left: 12px;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

In line 342 and 349, you're setting the width and height of the arrow icons to 40px, but in lines 274 and 280, you've set them to 20px. Make sure these values are consistent across your codebase to avoid visual inconsistencies.

-   width: 40px;
-   height: 40px;
+   width: 20px;
+   height: 20px;

Comment on lines 411 to +415

.lsx-itinerary-wrapper .hidden,
.lsx-units-wrapper .hidden {
display: none;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

This rule seems to be redundant as it's identical to the one above it (lines 407-409). Consider removing it to keep your CSS clean and maintainable.

- .lsx-itinerary-wrapper .hidden,
- .lsx-units-wrapper .hidden {
-   display: none;
- }

.lsx-units-wrapper .hidden {
display: none;
}
/*# sourceMappingURL=style.css.map */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

It's a good practice to end your files with a newline. This can prevent potential parsing errors and improves compatibility across different tools and systems.

- /*# sourceMappingURL=style.css.map */
+ /*# sourceMappingURL=style.css.map */
+ 

@krugazul krugazul self-requested a review December 12, 2024 13:13
Copy link
Collaborator

@krugazul krugazul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive moved the CSS to the Sass files using AI to convert it. There were some errors that needed to be fixed.

#366

@krugazul krugazul merged commit 70abbf3 into 2.0-beta-3 Dec 12, 2024
6 of 8 checks passed
@krugazul krugazul deleted the additional-info-read-more branch December 12, 2024 13:16
@ZaredRogers ZaredRogers linked an issue Jan 9, 2025 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Dev] CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Tours Tours post type related issues and PRs [Status] Needs Review Pull request needing a review [Type] Enhancement A suggestion for improvement
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Read more block variation - Open Modals
2 participants