Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Faq Pattern Section #158

Merged
merged 17 commits into from Sep 6, 2023
Merged

Faq Pattern Section #158

merged 17 commits into from Sep 6, 2023

Conversation

esrat71
Copy link
Contributor

@esrat71 esrat71 commented Aug 31, 2023

Faq section designed

Description

faq section designed as pattern

Reference to the issue that the PR fixes:
#119

Screenshots
https://prnt.sc/CDb7GJTljavD

Testing Instructions

  1. Activate the theme.
  2. Create a pettern named faq
  3. Add the code viewing as code editor.
  4. See the changes

Another way

  1. copy the code
    
  2. Create a faq php file and see the changes
    

Faq section designed
@carolinan
Copy link
Contributor

Thank you. A few things:

In the pull request description please add a reference to the issue that the PR fixes:
#119

All texts need to use translation functions. Please see the documentation here: https://developer.wordpress.org/apis/internationalization/

The pattern needs to use a list block with a custom style, not paragraphs and HRs.

@carolinan
Copy link
Contributor

Here is an example of how to add a custom style for the list block:
https://github.com/WordPress/twentytwentyfour/pull/150/files#diff-01c9525afc2c87cfcb03124117c9d0ebb067029f6c955a607fa0fd4274aca556R70

@esrat71
Copy link
Contributor Author

esrat71 commented Aug 31, 2023

Okay, Thank you for review. I am going to make it with list item with custom style. Here's a query for custom style, I f i add a register block style , may need to add css, then should i do that in style css file or what's the procedure actually.

@carolinan
Copy link
Contributor

Add it to style.css for now.

patterns/faq.php Outdated

<!-- wp:group {"style":{"color":{"background":"#101010"},"spacing":{"padding":{"top":"8vh","bottom":"8vh","left":"6px","right":"6px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="background-color:#101010;padding-top:8vh;padding-right:6px;padding-bottom:8vh;padding-left:6px"><!-- wp:heading {"style":{"elements":{"link":{"color":{"text":"var:preset|color|base-2"}}},"typography":{"fontSize":"10rem","letterSpacing":"-0.02em"}},"textColor":"base-2"} -->
<h2 class="wp-block-heading has-base-2-color has-text-color has-link-color" style="font-size:10rem;letter-spacing:-0.02em">FAQs</h2>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ready For Translation

patterns/faq.php Outdated
<p class="has-base-2-color has-text-color has-link-color has-medium-font-size">↓ Can I apply to be a part of the team or work as a contractor?</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

file must end with a newline

patterns/faq.php Outdated
<!-- /wp:heading -->

<!-- wp:group {"style":{"border":{"top":{"color":"#ffffff33","width":"1px"},"right":{"width":"0px","style":"none"},"bottom":{"color":"#ffffff33","width":"1px"},"left":{"width":"0px","style":"none"}},"spacing":{"padding":{"top":"15px","bottom":"15px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="border-top-color:#ffffff33;border-top-width:1px;border-right-style:none;border-right-width:0px;border-bottom-color:#ffffff33;border-bottom-width:1px;border-left-style:none;border-left-width:0px;padding-top:15px;padding-bottom:15px"><!-- wp:paragraph {"style":{"elements":{"link":{"color":{"text":"var:preset|color|base-2"}}},"layout":{"selfStretch":"fit","flexSize":null}},"textColor":"base-2","fontSize":"medium"} -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

use contrast-3 for all border color

patterns/faq.php Outdated

?>

<!-- wp:group {"style":{"color":{"background":"#101010"},"spacing":{"padding":{"top":"8vh","bottom":"8vh","left":"6px","right":"6px"}}},"layout":{"type":"constrained"}} -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

use align: full width and background-color: contrast

patterns/faq.php Outdated

<!-- wp:group {"style":{"border":{"top":{"color":"#ffffff33","width":"1px"},"right":{"width":"0px","style":"none"},"bottom":{"color":"#ffffff33","width":"1px"},"left":{"width":"0px","style":"none"}},"spacing":{"padding":{"top":"15px","bottom":"15px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="border-top-color:#ffffff33;border-top-width:1px;border-right-style:none;border-right-width:0px;border-bottom-color:#ffffff33;border-bottom-width:1px;border-left-style:none;border-left-width:0px;padding-top:15px;padding-bottom:15px"><!-- wp:paragraph {"style":{"elements":{"link":{"color":{"text":"var:preset|color|base-2"}}},"layout":{"selfStretch":"fit","flexSize":null}},"textColor":"base-2","fontSize":"medium"} -->
<p class="has-base-2-color has-text-color has-link-color has-medium-font-size">↓ What is your process working in smaller projects?</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prepare all content for translation

@huzaifaalmesbah
Copy link
Collaborator

also use already registered pattern categories or register a new category faq.
Screenshot 2023-08-31 at 10 53 49 AM

@esrat71
Copy link
Contributor Author

esrat71 commented Aug 31, 2023

@huzaifaalmesbah Thank you for reviewing. I am going to do the needful changes and will removed the category also. Will submit asap.

Added custom block style in function , custom css and the main faq file with list block
@juanfra juanfra linked an issue Aug 31, 2023 that may be closed by this pull request
Have translable all the hard coded string text and also changed the css file for list item
@esrat71
Copy link
Contributor Author

esrat71 commented Aug 31, 2023

hi , @carolinan , sorry to bother you . Can you please guide me. My PHP code is getting failed all time for indention issue. Kinda lost in somewhere. I have used tab as indention still getting error.

@juanfra
Copy link
Member

juanfra commented Aug 31, 2023

Thanks for the contribution @esrat71!

One way to check what's going wrong with the code quality issues, is by checking the results of the failed test for the PR. You can also click on the Files Changed tab for the PR to see the fails in their respective lines.

Another way could be running the test in your local environment. You can do that by running:

composer install && composer run standards:check

You can find more information about testing on the project's readme.

I also recommend you check how to use the translation functions in the context of patterns. You could probably check the conversation that took place yesterday in Slack to get more context on when to use esc_html__ vs esc_html_x.

@esrat71
Copy link
Contributor Author

esrat71 commented Aug 31, 2023

Thanks for the contribution @esrat71!

One way to check what's going wrong with the code quality issues, is by checking the results of the failed test for the PR. You can also click on the Files Changed tab for the PR to see the fails in their respective lines.

Another way could be running the test in your local environment. You can do that by running:

composer install && composer run standards:check

You can find more information about testing on the project's readme.

I also recommend you check how to use the translation functions in the context of patterns. You could probably check the conversation that took place yesterday in Slack to get more context on when to use esc_html__ vs esc_html_x.

Thank you. I am again going to check if i can resolve the issue

patterns/faq.php Outdated
<div class="wp-block-group has-contrast-background-color has-background" style="padding-top:8vh;padding-right:6px;padding-bottom:8vh;padding-left:6px"><!-- wp:heading {"style":{"elements":{"link":{"color":{"text":"var:preset|color|base-2"}}},"typography":{"fontSize":"10rem","letterSpacing":"-0.02em"}},"textColor":"base-2"} -->
<h2 class="wp-block-heading has-base-2-color has-text-color has-link-color" style="font-size:10rem;letter-spacing:-0.02em">FAQs</h2>
<div class="wp-block-group has-contrast-background-color has-background" style="padding-top:8vh;padding-right:6px;padding-bottom:8vh;padding-left:6px"><!-- wp:heading {"style":{"elements":{"link":{"color":{"text":"var:preset|color|base-2"}}},"typography":{"fontSize":"10rem","letterSpacing":"-0.02em"}},"textColor":"base-2"} -->
<h2 class="wp-block-heading has-base-2-color has-text-color has-link-color" style="font-size:10rem;letter-spacing:-0.02em"<?php echo esc_html__( 'FAQs?', 'twentytwentyfour' ); ?>></h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please look carefully, this code is missing a closing tag and is broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay , checking again . Thank you

have checked again , added all translable strings..
added and removed space after watching following brackets
style.css Outdated
.is-style-faq-check-lists li::before {
content: "\2193";
position: absolute;
left: 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you so much for working on this. My main concern about this solution are RTL languages. In those cases we want the checkmark to be positioned to the right instead. This is the only official docs I found on RTL. It looks like we are going to need an extra stylesheet just for this. Do you know a better way @carolinan?

Copy link
Member

@juanfra juanfra Sep 4, 2023

Choose a reason for hiding this comment

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

Another option could be using the .rtl class that's automatically added to the body for RTL languages (if the idea is to avoid having a separate stylesheet).

Copy link
Contributor

Choose a reason for hiding this comment

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

I recently tried to use the .rtl class in a Gutenberg block and found that it is not used in the iframed block editor(!)
The editor uses <html dir="rtl"> and we can not target children of elements with this attribute.
See https://developer.mozilla.org/en-US/docs/Web/CSS/:dir

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we perhaps try to fix it in Gutenberg? WordPress/gutenberg#51480

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure we have enough time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should i try to use in different way without children ? like as just user can copy the icon and list item will as normal list item .

Copy link
Contributor Author

@esrat71 esrat71 Sep 4, 2023

Choose a reason for hiding this comment

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

Then User will have to icon like this and space between the item like the example https://prnt.sc/YnphTJPkKVnD What do you think ? as some of section in white background using this type pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and one more thing, i tried to using marker and list style image, if i use list-style-position as normal , the list item border is not working as expected we want in design https://prnt.sc/avLaO4fbHqyR

@MaggieCabrera
Copy link
Collaborator

I've made a few changes to this PR, the main one being that I changed the list block with the details block, so now we have the functionality of showing/hidding text for each FAQ item. I think this pattern is perfect to showcase this recently added block. Let's follow up with improvements and add some sample text to each of the FAQ items text. @beafialho can you provide some sample text for these, please?

@MaggieCabrera MaggieCabrera merged commit a435493 into WordPress:trunk Sep 6, 2023
2 checks passed
@beafialho
Copy link

Absolutely, I have also imagined this to use the details block. Here's some sample text, it can be used for all of the questions:

Études offers comprehensive consulting, management, design, and research solutions. Our vision is to be at the forefront of architectural innovation, fostering a global community of architects and enthusiasts united by a passion for creating spaces. Every architectural endeavor is an opportunity to shape the future.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block Patterns - FAQ
6 participants