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

Refactor modal content (fixes #291 and @292) #324

Merged
merged 29 commits into from
Feb 10, 2021

Conversation

OtisRed
Copy link
Contributor

@OtisRed OtisRed commented Nov 11, 2020

Story / Bug id:

#291 and #292

Description:

It was easier for me conceptually to go through both those tickets at the same time. Most important changes incude:

  1. Title breaks by words in case of overlay - it was breaking by letters before.
  2. I introduced h2 and h3 tags to structure the content for SEO reasons.
  3. In mobile view I moved the close button to the bottom-right corner. It made a lil bit more space for the title on smaller devices and made it easier to use close button in mobile view (it's closer to a thumb).
  4. I centered all the content. Seems more intuitive this way.
  5. All the buttons are rendered conditionally based on the condition that there actually is something to show.
  6. "Partner" and "stack" sections are also rendered conditionally.
  7. I recomposed partner/s section, because we had long text buttons that wouldn't break in case of an overlay.
  8. I dropped v-btn, v-icon and v-card - I styled them with CSS and moved some scoped classes to global.scss

Migrations:

I nested partner partners' attributes in the partner object, which is a list now.

New imports / dependencies:

N/A

What tests do I need to run to validate this change:

  1. Run in docker
  2. Check visually - especially on smaller screens
  3. Check if conditional rendering works properly

@OtisRed OtisRed changed the title [WIP] Adjust heading in modal content (fixes #291) [WIP] Adjust heading in modal content (fixes #291 and @292) Nov 25, 2020
@OtisRed OtisRed changed the title [WIP] Adjust heading in modal content (fixes #291 and @292) Refactor modal content (fixes #291 and @292) Nov 25, 2020
</v-card-actions>
</v-row>
<v-card-title class="container-title unified-padding">
<h1>{{ selectedProject.name }}</h1>

Choose a reason for hiding this comment

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

If it is possible to give it a class, that way we remain a flat hierarchy of selectors. Or if styles for headings can be used also in other components you can reconsider moving it to global styles

Copy link
Contributor Author

@OtisRed OtisRed Dec 17, 2020

Choose a reason for hiding this comment

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

Given our discussion of h1 tags we should decide whether using h1 here is appropriate at all. Whatever the class should be, I wouldn't argue moving it, at least in part, to the global class. Will keep you posted on the adjustments.

Copy link
Contributor Author

@OtisRed OtisRed Dec 31, 2020

Choose a reason for hiding this comment

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

Final changes:

  1. I removed h1 tag to reserve it for singular use only - although multiple h1 tags don't matter anymore in html 5, because web crawlers use sections to understand the structure in more modular way (e.g. Google) people still believe that it is the best practice. Basically the argument is that with the singular use you don't lose anything but you may gain sth in particular cases.
  2. So I used h2 and h3 tags instead - both went to global classes with some local override for the main title.

<h1>{{ selectedProject.name }}</h1>
<div>
<v-btn class="hidden-xs-only" rounded icon large @click="onClick()">
<v-icon size="3.5rem" color="white">close</v-icon>

Choose a reason for hiding this comment

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

would be better to pass it as some variables not hardcoded like that, if not pass color as hex (#ffffff) not white
you can try this approach:
https://stackoverflow.com/a/61378302

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. so the options in the link regard the situation when I actually want to change sth about default vuetify settings. Given that I realize how fucked up it is to have part of the styling through vuetify props and others through regular classes is there actually a reason to try to overwrite that? I mean veutfy is what it is, but isn't it overkill to write css just to override the default settings to the same effect? Please straight me out if I'm wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Final changes:

  1. I dropped v-btn and v-icon altogether (in this case vuetify does more harm than good)
  2. I created global classes for two kinds of buttons which use globally defined colors

<v-card-actions class="buttons-list unified-padding">
<div v-show="selectedProject.licensePage !== ''">
<v-btn text rounded :href="selectedProject.licensePage" target="_blank">
<v-icon>far fa-copyright</v-icon>

Choose a reason for hiding this comment

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

why not to use https://vuetifyjs.com/en/features/icons/#using-custom-icons and create component with icons? this way you write it once and then use it in a whole project
also I'd add some accessibility here like aria-label

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems awsome. I'll try to implement that.

Copy link
Contributor Author

@OtisRed OtisRed Dec 31, 2020

Choose a reason for hiding this comment

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

Final changes:
Global store for icons seems to be a really good idea but when I started playing with it both through Vuetify and Font Awsome I couldn't find the way that actually save code. To the contrary, it did introduce another layer of abstraction which doesn't seem that necessary at this point. For now I settled with the basic local use of FA with <i> tag.

I still believe global store for icons is a good idea but I think it goes beyond the scope of this task to do it right. I will create a new issue for that.

</div>
<div v-show="selectedProject.githubLink !== ''">
<v-btn text rounded :href="selectedProject.githubLink" target="_blank">
<v-icon>fab fa-github</v-icon>

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

<v-card-text class="unified-padding">
<p class="text-center">{{ selectedProject.description }}</p>
</v-card-text>
<div v-show="countPartners >> 0">

Choose a reason for hiding this comment

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

is >> it ok? not just > ?

Copy link
Contributor Author

@OtisRed OtisRed Dec 17, 2020

Choose a reason for hiding this comment

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

Final changes:
You're right. For some reason webstorm was correcting me on a singular use, but actually it seems to work fine. FYI VSC doesn't claim that kind of problem :D

<v-col class="partner-item" cols="12" sm="3">
<v-btn class="buttons-chips" text :href="partners.link" rounded>
<span class="buttons-text">Poznaj</span>
<v-icon>fas fa-hands-helping</v-icon>

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

h2 {
font-family: $font-content;
font-size: 1.5rem;
color: black;

Choose a reason for hiding this comment

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

use variable

Copy link
Contributor Author

@OtisRed OtisRed Dec 17, 2020

Choose a reason for hiding this comment

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

Well... we didn't have global black defined :D I'll work on that => promise (I realize that promise isn't usually what you return in a function => just an inside joke :P )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Final changes:
That's done

.buttons {
margin: 1rem 0.5rem 1rem 0;
.buttons-close {
background-color: $blue !important;

Choose a reason for hiding this comment

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

is !important needed? I guess you can add another class to the element and then you don't have to use such an overwriting

Copy link
Contributor Author

@OtisRed OtisRed Dec 17, 2020

Choose a reason for hiding this comment

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

Yes, this is the kind of moment when not using important results in nothing. So either I can use in-line prop where I cannot use $var and need to repeat $blue var's hex or can I use important to overrride whatever vuetify understands. I didn't figure out how to pass global $blue into html part of code. That's why this blasphemy is here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Final changes:
I dropped v-btn altogether so that's not an issue no more

justify-content: center;
text-align: center;
@media only screen and (max-width: $phone) {
padding: 2% 10%;

Choose a reason for hiding this comment

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

it's not easy to predict how it will behave on different devices (resolutions), if you use rem I would stay with that, not mixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. However if it was you to consider some kind of understand what measure would you use? Is rem the best choice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Final changes:
U used REMs both for desktop and mobile view

}

.unified-padding {
padding: 0.5rem 1.5rem !important;

Choose a reason for hiding this comment

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

same as above - add another class, !imporant should be the laaaaaaaaaaast thing you can think about xd

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really it was. I usually use !importnat when I feel helpless with vuetify :P However this change had been override and I will actually try to replace vuetify for clear vue in the whole component. We'll see if that's needed then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Final changes:
I dropped using vuetify's v-card to style the container so it's not a problem anymore

@OtisRed OtisRed mentioned this pull request Jan 6, 2021
@OtisRed OtisRed merged commit d593504 into CodeForPoznan:master Feb 10, 2021
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