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

Frontend Assessment - Jin #58

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
beb669e
setup project
basinghse Aug 25, 2024
b5e9f7c
setup tailwind
basinghse Aug 25, 2024
b19cc20
setup folder structure; tdd
basinghse Aug 25, 2024
d9e7eba
create and test hero component
basinghse Aug 25, 2024
a3ae73f
add card component
basinghse Aug 25, 2024
494d08f
uppercase card button text
basinghse Aug 25, 2024
a0e0b7b
fix hero text; add unit tests
basinghse Aug 25, 2024
b95dc88
resolve test matchers; use compatible package versions
basinghse Aug 25, 2024
5fba1f0
encapsulate styling in scss; use BEM syntax
basinghse Aug 25, 2024
e5e5158
ignore lint css condition
basinghse Aug 25, 2024
0f1eef1
apply classNames from style file
basinghse Aug 25, 2024
59d4939
improve folder structure
basinghse Aug 25, 2024
09e04fa
add navigation and routing
basinghse Aug 25, 2024
86e1247
add new page and test tempalte
basinghse Aug 25, 2024
1fe818a
install react router dom
basinghse Aug 25, 2024
d4d491c
move data; create tabs and accordion base
basinghse Aug 25, 2024
0f3a167
test tab/accordion
basinghse Aug 25, 2024
7741af1
add animation and extend TabAccordion
basinghse Aug 25, 2024
63aad58
validate section data; improve wording; add improvement notes
basinghse Aug 25, 2024
f31d372
install helper packages
basinghse Aug 25, 2024
56baabf
fulfill data requirements;
basinghse Aug 25, 2024
0914bd2
create polymorphic component for animated content
basinghse Aug 25, 2024
481c0b2
improve folder structure
basinghse Aug 25, 2024
f565ff2
setup styling in scss
basinghse Aug 25, 2024
4fec9e9
comment
basinghse Aug 25, 2024
52a79c9
fix landing page tests
basinghse Aug 25, 2024
72f44c3
dynamic content test cases
basinghse Aug 25, 2024
f69eb50
style navbar
basinghse Aug 25, 2024
b368453
Update file names
basinghse Aug 25, 2024
62f4920
update font family
basinghse Aug 25, 2024
6cf3392
update font family
basinghse Aug 25, 2024
3bbb23c
finalise readme
basinghse Aug 25, 2024
8b3735b
fix type
basinghse Aug 25, 2024
76cb142
update production links
basinghse Aug 26, 2024
6393c44
update production link
basinghse Aug 26, 2024
cd71691
move navbar to footer
basinghse Aug 28, 2024
7333755
add image attribution
basinghse Aug 28, 2024
a67f674
style attribution
basinghse Aug 28, 2024
0fcc603
style attribution
basinghse Aug 28, 2024
2ad47b2
Merge branch 'master' of https://github.com/basinghse/ecommify
basinghse Aug 28, 2024
d644aa5
adjust card rounding, text colour, button
basinghse Aug 28, 2024
408648a
hero: spacing, line height, image text
basinghse Aug 28, 2024
0c73c92
correct mobile view and setup image size text
basinghse Aug 28, 2024
e2fb027
add new font and styles
basinghse Aug 28, 2024
44b6acc
stack nav links for mobile; always display attribution
basinghse Aug 28, 2024
73ad0e9
space out size text
basinghse Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"scss.lint.unknownAtRules": "ignore"
}
108 changes: 68 additions & 40 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,68 @@
Introduction
---
Thanks for taking the time to complete this frontend technical assessment. We will be focusing on software quality (scalability, readability, maintainability, etc.) and your eye for detail. You may include any libraries, but Vue.js is preferred and jQuery is not recommended. Along with following best practices, bonus points for following our [coding guidelines](https://github.com/mindarc/frontend-assessment/wiki/Coding-guidelines).

Exercise 1
---
Build a responsive page based on the designs.

##### Requirements
1. Match the designs exactly.
2. Needs to be responsive.

##### Designs
* exercise1-desktop.png
* exercise1-mobile.png

##### Assets
* Desktop banner - https://via.placeholder.com/1920x650
* Mobile banner - https://via.placeholder.com/600x600
* Content images - https://via.placeholder.com/400x300

Exercise 2
---
Read the `data.json` file and display the data as tabs on desktop and an accordion on mobile.

##### Requirements
1. Display data in tabs on desktop.
2. Display data in an accordion on mobile.
3. Only 1 accordion/tab should be open at a time.
4. Open the first accordion/tab on load.
5. If the open accordion is selected, close it.

###### Bonus points
* Improve the user experience with meaningful animations/transitions.
* Design and styling.
* Explain why the result of `('b' + 'a' + + 'a' + 'a').toLowerCase()` is `banana`.

Submission
---
We recommend submitting your completed assessment as a forked repository. Please replace README content with instructions and relevant documentation.
# Ecommify

A blueprint for the layout of an e-commerce website.

## Technologies

| Technology | Description |
| ----------------- | ------------------------------------------------ |
| React | JavaScript library for building user interfaces |
| TypeScript | Primary language for programming |
| Vite | Build tool |
| Vitest/Jest DOM | Unit testing |
| Tailwind CSS | CSS framework for styling |
| Frame motion | Animation |
| Vercel | Live web deployment |

## Running the app

### Production

[ecommify-blueprint.vercel.app](https://ecommify-blueprint.vercel.app/)

### Local

**Pre-requisites:**

- Node.js and npm - [download](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- Git - [download](https://git-scm.com/downloads)

To run the application locally, follow these steps:

1. Download the zip file and open the project in VS code or clone the repository via terminal: `git clone https://github.com/basinghse/ecommify.git`
2. Navigate from the root folder to the web folder: `cd web`
3. Install dependencies: `npm install`
4. Run the application: `npm run dev`
5. Navigate to the URL i.e. `http://localhost:5173/`
6. (Optional) Run unit tests: `npm run test`

## Questions

**Explain why the result of `('b' + 'a' + + 'a' + 'a').toLowerCase()` is `banana`.**

- When you add two strings, they combine. The first operation 'b' + 'a' becomes `ba`.
- The middle operation has two + symbols. The first one is treated as a plus, so the second becomes an unary operator trying to convert the next character to a number
- 'a' can't be converted to a number, so it becomes NaN (Not a Number)
- 'ba' + (+a) becomes `baNaN`
- Adding the final 'a' we get 'baNaNa', which is converted to lowercase to give a final result of `banana`

## References

[BEM and SASS](https://andrew-barnes.medium.com/bem-and-sass-a-perfect-match-5e48d9bc3894)
[SASS parent selectors](https://sass-lang.com/documentation/style-rules/parent-selector/)
[Responsive design](https://tailwindcss.com/docs/responsive-design)

## Ideas

- Stylistic choices for alignment of section data to the left or centre, currently centred.
- Slight repetition in [Hero](/web/src/components/Hero.tsx), however it is a small component. Consider refactoring if it gets larger.
- The nav bar could be improved to include a transparent darker background
- Expandable cards/redirections from users clicking on read more
- A home page displaying a demo of both pages (exercises) before viewing a single page
- A footer with social media links/copyright
- Establish eslint rules
- More extensive unit testing
- Skeleton loading: when using more complex data i.e. fetching from an API this would improve user experience while the data is loaded
- Creation of more common constants, themes for sharing
- Introducing a logger service such as Winston to receive errors
- Introduce a snackbar for user feedback - ideally for errors and especially when adding more complex interactions such as form submissions
24 changes: 24 additions & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
28 changes: 28 additions & 0 deletions web/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
15 changes: 15 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ecommify</title>
<link href="https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@300;400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400;500;700&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading