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

Feature/contacts #139

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open

Feature/contacts #139

wants to merge 23 commits into from

Conversation

jlcrodrigues
Copy link

Closes #17

Created the contacts page for both PC and mobile.

Screenshots

Review checklist

  • Contains enough appropriate tests
  • Behavior is as expected
  • Clean, well-structured code

@BrunoRosendo BrunoRosendo requested a review from a team April 5, 2023 15:30
Copy link
Contributor

@pedrosilva17 pedrosilva17 left a comment

Choose a reason for hiding this comment

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

Great work! I have some suggestions that might improve the code a little bit, let me know if you agree with them.

Comment on lines 33 to 49
{#if windowWidth >= 768}
<img
alt="Feup Buildings Outline"
src="/images/feup_buildings_md.svg"
class="align-center justify-self-center w-full"
style="min-width:400px; height:200px; object-fit: none; object-position: center;"

/>
{:else}
<img
alt="Feup Buildings Outline"
src="/images/feup_buildings.svg"
class="align-center justify-self-center w-full"
style="min-width:400px; min-height:160px; object-fit: none; object-position: center;"

/>
{/if}
Copy link
Contributor

@pedrosilva17 pedrosilva17 Apr 12, 2023

Choose a reason for hiding this comment

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

  • The inline style tags are not necessary and can be applied with tailwind (object-none, object-center, min-wand min-h), although with slightly different px values (for example, h-52 is equal to height:208px; which I would say is close enough). If you really need exactly 200px, you can use h-[200px], which is not as clean as the previous tailwind class. Moreover, some classes are not very useful from what I've seen, like the min-widths and min-heights (the latter of which can just be converted to height in this case, I think, as the difference is not noticeable). Again, if you feel like they should be preserved, you can pass an arbitrary value to the min-w and min-hclasses using square brackets like I did above.
  • This if/else statement can be replicated using a <picture> tag (read more about it here). Avoids repeating common parts of the image, like the alt text and almost all classes, and doesn't need to use a variable that stores the width of the window, instead changing the source of the image based on a breakpoint. The tag is supported by every modern browser (post-2015), but we can discuss its usage in the meeting later today. For the classes that change depending on the window width, just use the tailwind md:breakpoint, which has the exact same px value as the if condition.

Comment on lines 64 to 74
<style>
form > input {
width: 100%;
}

@media (min-width: 1050px) {
#location {
width: 1039px;
}
}
</style>
Copy link
Contributor

Choose a reason for hiding this comment

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

These can be achieved with tailwind as well.

  • Use w-full in each input's class
  • Use lg:w-[1039px] inside the span's class (the breakpoint targets devices with 1024px of width or greater and sets the width of the span to 1039px in those cases).

Keep in mind the arbitrary value attribution with square brackets is reserved for situations where there are no native similar values, which is the case here.

Comment on lines 18 to 25
<label class="m-1 text-white font-source-code" for="email">// Email</label><br>
<input class="rounded-lg p-1 text-primary placeholder-primary" type="email" id="email" placeholder="[email protected]"><br>
<label class="m-1 text-white font-source-code" for="name">// Nome</label><br>
<input class="rounded-lg p-1 text-primary placeholder-primary" type="text" id="name"><br>
<label class="m-1 text-white font-source-code" for="subject">// Assunto</label><br>
<input class="rounded-lg p-1 text-primary placeholder-primary" type="text" id="subject"><br>
<label class="m-1 text-white font-source-code" for="message">// Mensagem</label><br>
<textarea class="rounded-lg p-1 text-primary placeholder-primary" id="message"></textarea><br>
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Maybe each label/input pair could be converted into a component? I imagine we could potentially have inputs like these in other places of the website, plus it improves readability and reduces code repetition. The parameters to be passed could be the for, typeand placeholder labels.
  • The font is actually named source_codeand not source-code, I changed it in my commit to avoid putting brackets around the name in tailwind config file. In hindsight, that might not have been the best decision, as it looks strange in a tailwind class. Maybe it could be reverted and you don't need to change the name here, but just know that the font is not being rendered properly with this code. We'll discuss that in the meeting.

Copy link

@srissirs srissirs left a comment

Choose a reason for hiding this comment

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

It's looking good! Though I think there should be more space between the fields. The titles are a bit too close to the field directly above. Also, the graph in the mobile version does not seem to be centered. Could you fix that too?

@jlcrodrigues
Copy link
Author

@srissirs @pedrosilva17 Thank you for the feedback. I think I fixed the problems mentioned. Please take another look.

Copy link
Member

@BrunoRosendo BrunoRosendo left a comment

Choose a reason for hiding this comment

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

Good job so far! I have a few suggestions

src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
src/routes/contacts/+page.svelte Outdated Show resolved Hide resolved
src/routes/contacts/+page.svelte Outdated Show resolved Hide resolved
src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
Copy link
Member

@BrunoRosendo BrunoRosendo left a comment

Choose a reason for hiding this comment

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

just small stuff

src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
src/routes/contacts/Graph.svelte Outdated Show resolved Hide resolved
Comment on lines 29 to 30
<source media="(max-width: 768px)" srcset="/images/feup_buildings.svg" />
<source media="(min-width: 769px)" srcset="/images/feup_buildings_md.svg" />
Copy link
Member

Choose a reason for hiding this comment

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

why doesn't it use the same pixels?

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8497122) to head (9e3d0cc).

Additional details and impacted files
@@            Coverage Diff            @@
##           develop      #139   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           16        16           
  Branches         4         4           
=========================================
  Hits            16        16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@LuisDuarte1 LuisDuarte1 left a comment

Choose a reason for hiding this comment

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

Overall it looks great, great job 🚀, there's some issues with z-index and the hexagon outline, which I believe that are already fixed on develop? So try to merge and see if that's fixed ^^. Just have some minor concern below, but great job otherwise 🎉

Copy link
Member

Choose a reason for hiding this comment

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

Any reason why you've scaled the hexagon outline?

Copy link
Member

@BrunoRosendo BrunoRosendo left a comment

Choose a reason for hiding this comment

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

I'm approving since the feature is looking great! There are just a few side things missing:

  • Fix lint
  • Create storybook stories and tests (I'll leave this as the team's discretion, since you may want to save time on this)

@MRita443 MRita443 requested a review from rubuy-74 July 20, 2024 11:32
Copy link
Collaborator

@MRita443 MRita443 left a comment

Choose a reason for hiding this comment

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

Looking good overall, a couple file placement and file name consistency changes since the restructuring, and please add the new component to storybook. Otherwise (this might be a bit nit picky) but I noticed when scaling the page at one point I shrink the page and the forms gets bigger which looks a bit odd. Is this easily fixable? If not I say we keep it this way

Screencast.from.03-08-2024.12.44.24.webm

"version": "6.2.0",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",
"integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew=="
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Were these removed dependencies not being used?

Copy link

Choose a reason for hiding this comment

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

I didn't change any of the dependencies, the file was generated like this.

src/lib/components/icons/LabelInput.svelte Outdated Show resolved Hide resolved
src/routes/(app)/contacts/Graph.svelte Outdated Show resolved Hide resolved
Copy link
Collaborator

@MRita443 MRita443 left a comment

Choose a reason for hiding this comment

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

Seems ready but just some small comments!

Comment on lines +1 to +23
<script>
export let label = '';
export let id = '';
export let type = 'text';
export let placeholder = '';
export let isTextArea = false;
</script>

<label class="m-1 font-source_code font-bold text-white" for={id}>{label}</label><br class="mb-1" />
{#if isTextArea}
<textarea
class="mb-2 w-full rounded-lg p-2 font-source_code text-primary placeholder-primary"
{id}
rows="4"
/><br />
{:else}
<input
class="mb-2 w-full rounded-lg p-2 text-primary placeholder-primary"
{type}
{id}
{placeholder}
/><br />
{/if}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd be beneficial to put this component on storybook

Comment on lines 1 to 81
<script lang="ts">
import Icon from '@/lib/components/icons/icon.svelte';
import Icons from '$lib/components/icons/icons';
import { copyToClipboard } from '$lib/utils';

const coords = [
[1, 1],
[6, 3],
[2, 5],
[10, 6],
[1, 8],
[7, 8]
];
const lines = [
[0, 2],
[2, 1],
[1, 5],
[5, 3],
[2, 4]
];
let innerWidth = 0;
let coefficient = 8;
let iconSize = 8;

const socials = [
{ url: 'https://www.instagram.com/niaefeup/', icon: Icons.Instagram, label: 'Instagram' },
{ url: 'https://github.com/NIAEFEUP', icon: Icons.Github, label: 'Github' },
{ url: 'https://www.facebook.com/NIAEFEUP', icon: Icons.Facebook, label: 'Facebook' },
{ url: '[email protected]', icon: Icons.Mail, label: 'Email' },
{ url: 'https://www.linkedin.com/company/nifeup', icon: Icons.Linkedin, label: 'Linkedin' },
{ url: 'https://twitter.com/niaefeup', icon: Icons.Twitter, label: 'Twitter' }
];
</script>

<svelte:window bind:innerWidth />

<svg style="height: 40dvh; min-width: 35dvw" viewBox="0 0 87 80" xmlns="http://www.w3.org/2000/svg">
<!-- Draw graph edges. -->
{#each lines as line}
<line
x1={coords[line[0]][0] * coefficient}
y1={coords[line[0]][1] * coefficient}
x2={coords[line[1]][0] * coefficient}
y2={coords[line[1]][1] * coefficient}
class="stroke-vivid-red-900"
/>
{/each}

<!-- Draw graph nodes. -->
{#each coords as coord, index}
<foreignObject
x={coord[0] * coefficient - (iconSize + 2) / 2}
y={coord[1] * coefficient - (iconSize + 2) / 2}
width={iconSize + 2}
height={iconSize + 2}
>
{#if socials[index].url.startsWith('https')}
<div class="flex h-full w-full items-center justify-center rounded bg-white bg-opacity-30">
<Icon
src={socials[index].icon}
color="white"
size="{iconSize.toString()}px"
href={socials[index].url}
ariaLabel={socials[index].label}
/>
</div>
{:else}
<div
class="flex h-full w-full items-center justify-center rounded bg-white bg-opacity-30"
on:click={() => copyToClipboard(socials[index].url)}
on:keydown={() => copyToClipboard(socials[index].url)}
role="button"
tabindex="0"
aria-label="copy-mail"
>
<Icon src={socials[index].icon} color="white" size="{iconSize.toString()}px" />
</div>
{/if}
</foreignObject>
{/each}
</svg>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although less reusable it'd be nice to have this on storybook too, for example to test responsivity easily :) And please place this in src/routes/(app)/contacts/_components for consistency

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.

contacts: form page
9 participants