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

Rules List #340

Merged
merged 7 commits into from
Nov 23, 2024
Merged

Rules List #340

merged 7 commits into from
Nov 23, 2024

Conversation

merowin
Copy link
Collaborator

@merowin merowin commented Nov 22, 2024

This adds a new view that is linked to in the NavBar and has links to the rules page for variants with a (detailed) rules description.
Also I've added the demo board to the rules view as proposed in #112
I wasn't able to make sure that the demo board fits, so I made its container scrollable on overflow.

Rules List

grafik

grafik

grafik

Rules Page

grafik

grafik

@benjaminpjones
Copy link
Collaborator

benjaminpjones commented Nov 23, 2024

Very nice! These go great together, and I'm glad we're finally linking them from the main page.

I haven't had a chance to look at the code, but some visual thoughts:

  • Text is a bit wide IMO.
    • I searched around, and there is no one-size-fits-all approach. However, most readability guidelines fall in the 45-90 characters range, whereas this is about 130 characters long.
    • Narrowing the text may also solve the space issue for the demo board as well.
  • On mobile, text could use some margin - I think it's like 3 px now, I'd recommend at least 8px
    • Compare Medium.com, which gives 24px on mobile
    • This might actually be some feedback for the website in general (config form also seems a bit cramped without margin), so we don't need to address in this PR

Copy link
Collaborator

@benjaminpjones benjaminpjones left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -93,7 +93,6 @@
}
}

/* TODO: Check why this is here, can we remove this? */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean you figured it out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tested around a bit, and realised 2 things:
1.) We can view these as changes to the "default styles" of css, and I think these are good.
2.) Components can still overwrite these styles if need be.

I added this TODO when I added some detailed rules, and the markdown is displayed differently than I expected. For the rules it might still be worth to overwrite this, but it's fine for now imo.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense, thanks for the explanation!

@@ -0,0 +1,7 @@
export function toUpperCaseFirstLetter(string: string) {
Copy link
Collaborator

@benjaminpjones benjaminpjones Nov 23, 2024

Choose a reason for hiding this comment

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

Aside: Not a priority, but I feel like we should have some UI-friendly strings defined. The variant names are not really designed to be shown to the user.

v-for="variant in variantsWithRulesDescription"
:key="variant"
class="rules-link"
v-bind:to="{ name: 'rules', params: { variant: variant } }"
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI: Because of the inconsistency between :key and v-bind:to I want to point out, that : is a shorthand for v-bind:. See Vue's v-bind directive

Copy link
Collaborator

Choose a reason for hiding this comment

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

We might consider a lint rule (vue/v-bind-style or vue/vue3-strongly-recommended). We're pretty inconsistent across the codebase unfortunately.

Copy link
Collaborator Author

@merowin merowin Nov 23, 2024

Choose a reason for hiding this comment

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

I've changed it, will try to be more consistent! 😄 Thanks!

font-family: "helvetica", "arial", "sans-serif";
}

.grid-page-layout {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this the class that is used in the demo view? That could be clarified with a comment maybe

Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't <style scoped> prevent the style from getting used in DemoView anyway (without deep selector)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is what we renamed pageWrapper to. AFAIK with scoped it should only be applied to this component, and not its child components. see https://vue-loader.vuejs.org/guide/scoped-css.html

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I missed that the class was applied in this file too (I just saw it being deleted, overlooked it in the added part).

But:

With scoped, the parent component's styles will not leak into child components. However, a child component's root node will be affected by both the parent's scoped CSS and the child's scoped CSS. This is by design so that the parent can style the child root element for layout purposes.
SFC CSS Features | Vue.js

So I think it gets applied to both?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure what the documentation means with root node. Does this mean the DOM tree?
But I tried it, and indeed the style is applied to both in this case. Good to know!
I've pushed a change that makes sure it's only applied to the rules page layout in this case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

DemoView has <template><div class="grid-page-layout"> ... </div></template>, I think the template is ignored, so the <div class="grid-page-layout"> is the root node.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Didn't know about that, thanks for explaining!

@merowin
Copy link
Collaborator Author

merowin commented Nov 23, 2024

* Text is a bit wide  IMO.
  
  * I searched around, and there is no one-size-fits-all approach.  However, most readability guidelines fall in the 45-90 characters range, whereas this is about 130 characters long.
  * Narrowing the text may also solve the space issue for the demo board as well.

* On mobile, text could use some margin - I think it's like 3 px now, I'd recommend at least 8px
  
  * Compare Medium.com, which gives 24px on mobile
  * This might actually be some feedback for the website in general (config form also seems a bit cramped without margin), so we don't need to address in this PR

Thanks for the feedback! I've increased the padding on mobile to 12px (for all pages using grid-page-layout), and added some limits for the width of the text column.

@merowin merowin merged commit 90751b8 into main Nov 23, 2024
3 checks passed
@merowin merowin deleted the add_demo_board_to_rules_page branch November 24, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants