diff --git a/product-preview-card-component/.gitignore b/product-preview-card-component/.gitignore new file mode 100644 index 0000000..2e0e3a1 --- /dev/null +++ b/product-preview-card-component/.gitignore @@ -0,0 +1,19 @@ +# Avoid accidental upload of the Sketch and Figma design files +##################################################### +## Please do not remove lines 5 and 6 - thanks! 🙂 ## +##################################################### +*.sketch +*.fig + +# Avoid accidental XD upload if you convert the design file +############################################### +## Please do not remove line 12 - thanks! 🙂 ## +############################################### +*.xd + +# Avoid your project being littered with annoying .DS_Store files! +.DS_Store +.prettierignore + +node_modules +pnpm-lock.yaml \ No newline at end of file diff --git a/product-preview-card-component/README-template.md b/product-preview-card-component/README-template.md new file mode 100644 index 0000000..754dfe2 --- /dev/null +++ b/product-preview-card-component/README-template.md @@ -0,0 +1,111 @@ +# Frontend Mentor - Product preview card component solution + +This is a solution to the [Product preview card component challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/product-preview-card-component-GO7UmttRfa). Frontend Mentor challenges help you improve your coding skills by building realistic projects. + +## Table of contents + +- [Overview](#overview) + - [The challenge](#the-challenge) + - [Screenshot](#screenshot) + - [Links](#links) +- [My process](#my-process) + - [Built with](#built-with) + - [What I learned](#what-i-learned) + - [Continued development](#continued-development) + - [Useful resources](#useful-resources) +- [Author](#author) +- [Acknowledgments](#acknowledgments) + +**Note: Delete this note and update the table of contents based on what sections you keep.** + +## Overview + +### The challenge + +Users should be able to: + +- View the optimal layout depending on their device's screen size +- See hover and focus states for interactive elements + +### Screenshot + +![](./screenshot.jpg) + +Add a screenshot of your solution. The easiest way to do this is to use Firefox to view your project, right-click the page and select "Take a Screenshot". You can choose either a full-height screenshot or a cropped one based on how long the page is. If it's very long, it might be best to crop it. + +Alternatively, you can use a tool like [FireShot](https://getfireshot.com/) to take the screenshot. FireShot has a free option, so you don't need to purchase it. + +Then crop/optimize/edit your image however you like, add it to your project, and update the file path in the image above. + +**Note: Delete this note and the paragraphs above when you add your screenshot. If you prefer not to add a screenshot, feel free to remove this entire section.** + +### Links + +- Solution URL: [Add solution URL here](https://your-solution-url.com) +- Live Site URL: [Add live site URL here](https://your-live-site-url.com) + +## My process + +### Built with + +- Semantic HTML5 markup +- CSS custom properties +- Flexbox +- CSS Grid +- Mobile-first workflow +- [React](https://reactjs.org/) - JS library +- [Next.js](https://nextjs.org/) - React framework +- [Styled Components](https://styled-components.com/) - For styles + +**Note: These are just examples. Delete this note and replace the list above with your own choices** + +### What I learned + +Use this section to recap over some of your major learnings while working through this project. Writing these out and providing code samples of areas you want to highlight is a great way to reinforce your own knowledge. + +To see how you can add code snippets, see below: + +```html +

Some HTML code I'm proud of

+``` +```css +.proud-of-this-css { + color: papayawhip; +} +``` +```js +const proudOfThisFunc = () => { + console.log('🎉') +} +``` + +If you want more help with writing markdown, we'd recommend checking out [The Markdown Guide](https://www.markdownguide.org/) to learn more. + +**Note: Delete this note and the content within this section and replace with your own learnings.** + +### Continued development + +Use this section to outline areas that you want to continue focusing on in future projects. These could be concepts you're still not completely comfortable with or techniques you found useful that you want to refine and perfect. + +**Note: Delete this note and the content within this section and replace with your own plans for continued development.** + +### Useful resources + +- [Example resource 1](https://www.example.com) - This helped me for XYZ reason. I really liked this pattern and will use it going forward. +- [Example resource 2](https://www.example.com) - This is an amazing article which helped me finally understand XYZ. I'd recommend it to anyone still learning this concept. + +**Note: Delete this note and replace the list above with resources that helped you during the challenge. These could come in handy for anyone viewing your solution or for yourself when you look back on this project in the future.** + +## Author + +- Website - [Add your name here](https://www.your-site.com) +- Frontend Mentor - [@yourusername](https://www.frontendmentor.io/profile/yourusername) +- Twitter - [@yourusername](https://www.twitter.com/yourusername) + +**Note: Delete this note and add/remove/edit lines above based on what links you'd like to share.** + +## Acknowledgments + +This is where you can give a hat tip to anyone who helped you out on this project. Perhaps you worked in a team or got some inspiration from someone else's solution. This is the perfect place to give them some credit. + +**Note: Delete this note and edit this section's content as necessary. If you completed this challenge by yourself, feel free to delete this section entirely.** diff --git a/product-preview-card-component/README.md b/product-preview-card-component/README.md new file mode 100644 index 0000000..4e74131 --- /dev/null +++ b/product-preview-card-component/README.md @@ -0,0 +1,92 @@ +# Frontend Mentor - Product preview card component + +![Design preview for the Product preview card component coding challenge](./design/desktop-preview.jpg) + +## Welcome! 👋 + +Thanks for checking out this front-end coding challenge. + +[Frontend Mentor](https://www.frontendmentor.io) challenges help you improve your coding skills by building realistic projects. + +**To do this challenge, you need a basic understanding of HTML and CSS.** + +## The challenge + +Your challenge is to build out this product preview card component and get it looking as close to the design as possible. + +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: + +- View the optimal layout depending on their device's screen size +- See hover and focus states for interactive elements + +Want some support on the challenge? [Join our community](https://www.frontendmentor.io/community) and ask questions in the **#help** channel. + +## Where to find everything + +Your task is to build out the project to the designs inside the `/design` folder. You will find both a mobile and a desktop version of the design. + +The designs are in JPG static format. Using JPGs will mean that you'll need to use your best judgment for styles such as `font-size`, `padding` and `margin`. + +If you would like the design files (we provide Sketch & Figma versions) to inspect the design in more detail, you can [subscribe as a PRO member](https://www.frontendmentor.io/pro). + +You will find all the required assets in the `/images` folder. The assets are already optimized. + +There is also a `style-guide.md` file containing the information you'll need, such as color palette and fonts. + +## Building your project + +Feel free to use any workflow that you feel comfortable with. Below is a suggested process, but do not feel like you need to follow these steps: + +1. Initialize your project as a public repository on [GitHub](https://github.com/). Creating a repo will make it easier to share your code with the community if you need help. If you're not sure how to do this, [have a read-through of this Try Git resource](https://try.github.io/). +2. Configure your repository to publish your code to a web address. This will also be useful if you need some help during a challenge as you can share the URL for your project with your repo URL. There are a number of ways to do this, and we provide some recommendations below. +3. Look through the designs to start planning out how you'll tackle the project. This step is crucial to help you think ahead for CSS classes to create reusable styles. +4. Before adding any styles, structure your content with HTML. Writing your HTML first can help focus your attention on creating well-structured content. +5. Write out the base styles for your project, including general content styles, such as `font-family` and `font-size`. +6. Start adding styles to the top of the page and work down. Only move on to the next section once you're happy you've completed the area you're working on. + +## Deploying your project + +As mentioned above, there are many ways to host your project for free. Our recommended hosts are: + +- [GitHub Pages](https://pages.github.com/) +- [Vercel](https://vercel.com/) +- [Netlify](https://www.netlify.com/) + +You can host your site using one of these solutions or any of our other trusted providers. [Read more about our recommended and trusted hosts](https://medium.com/frontend-mentor/frontend-mentor-trusted-hosting-providers-bf000dfebe). + +## Create a custom `README.md` + +We strongly recommend overwriting this `README.md` with a custom one. We've provided a template inside the [`README-template.md`](./README-template.md) file in this starter code. + +The template provides a guide for what to add. A custom `README` will help you explain your project and reflect on your learnings. Please feel free to edit our template as much as you like. + +Once you've added your information to the template, delete this file and rename the `README-template.md` file to `README.md`. That will make it show up as your repository's README file. + +## Submitting your solution + +Submit your solution on the platform for the rest of the community to see. Follow our ["Complete guide to submitting solutions"](https://medium.com/frontend-mentor/a-complete-guide-to-submitting-solutions-on-frontend-mentor-ac6384162248) for tips on how to do this. + +Remember, if you're looking for feedback on your solution, be sure to ask questions when submitting it. The more specific and detailed you are with your questions, the higher the chance you'll get valuable feedback from the community. + +## Sharing your solution + +There are multiple places you can share your solution: + +1. Share your solution page in the **#finished-projects** channel of the [community](https://www.frontendmentor.io/community). +2. Tweet [@frontendmentor](https://twitter.com/frontendmentor) and mention **@frontendmentor**, including the repo and live URLs in the tweet. We'd love to take a look at what you've built and help share it around. +3. Share your solution on other social channels like LinkedIn. +4. Blog about your experience building your project. Writing about your workflow, technical choices, and talking through your code is a brilliant way to reinforce what you've learned. Great platforms to write on are [dev.to](https://dev.to/), [Hashnode](https://hashnode.com/), and [CodeNewbie](https://community.codenewbie.org/). + +We provide templates to help you share your solution once you've submitted it on the platform. Please do edit them and include specific questions when you're looking for feedback. + +The more specific you are with your questions the more likely it is that another member of the community will give you feedback. + +## Got feedback for us? + +We love receiving feedback! We're always looking to improve our challenges and our platform. So if you have anything you'd like to mention, please email hi[at]frontendmentor[dot]io. + +This challenge is completely free. Please share it with anyone who will find it useful for practice. + +**Have fun building!** 🚀 diff --git a/product-preview-card-component/assets/style.css b/product-preview-card-component/assets/style.css new file mode 100644 index 0000000..a300b27 --- /dev/null +++ b/product-preview-card-component/assets/style.css @@ -0,0 +1,771 @@ +@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"); + +body { + font-family: "Montserrat", sans-serif; + font-optical-sizing: auto; + font-weight: 500; + font-style: normal; +} + +/* +! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com +*/ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden] { + display: none; +} + +*, ::before, ::after{ + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; +} + +::backdrop{ + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; +} + +.m-auto{ + margin: auto; +} + +.my-4{ + margin-top: 1rem; + margin-bottom: 1rem; +} + +.mt-36{ + margin-top: 9rem; +} + +.flex{ + display: flex; +} + +.h-14{ + height: 3.5rem; +} + +.w-auto{ + width: auto; +} + +.cursor-pointer{ + cursor: pointer; +} + +.select-none{ + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} + +.flex-row{ + flex-direction: row; +} + +.items-center{ + align-items: center; +} + +.justify-center{ + justify-content: center; +} + +.gap-x-2{ + -moz-column-gap: 0.5rem; + column-gap: 0.5rem; +} + +.gap-x-4{ + -moz-column-gap: 1rem; + column-gap: 1rem; +} + +.rounded-lg{ + border-radius: 0.5rem; +} + +.bg-primary-cream{ + --tw-bg-opacity: 1; + background-color: hsl(30 38% 92% / var(--tw-bg-opacity)); +} + +.bg-primary-dark-cyan{ + --tw-bg-opacity: 1; + background-color: hsl(158 36% 37% / var(--tw-bg-opacity)); +} + +.bg-white{ + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.px-10{ + padding-left: 2.5rem; + padding-right: 2.5rem; +} + +.py-4{ + padding-top: 1rem; + padding-bottom: 1rem; +} + +.pt-2{ + padding-top: 0.5rem; +} + +.text-3xl{ + font-size: 1.875rem; + line-height: 2.25rem; +} + +.text-sm{ + font-size: 0.875rem; + line-height: 1.25rem; +} + +.font-bold{ + font-weight: 700; +} + +.tracking-widest{ + letter-spacing: 0.1em; +} + +.text-gray-400{ + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.text-gray-500{ + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.text-neutral-dark-blue{ + --tw-text-opacity: 1; + color: hsl(212 21% 14% / var(--tw-text-opacity)); +} + +.text-primary-dark-cyan{ + --tw-text-opacity: 1; + color: hsl(158 36% 37% / var(--tw-text-opacity)); +} + +.text-white{ + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.line-through{ + text-decoration-line: line-through; +} + +#card { + width: 800px; + height: auto; +} + +#card-image { + background-repeat: no-repeat; + background-size: cover; + background-image: url(../images/image-product-desktop.jpg); + width: 100%; + border-bottom-left-radius: 8px; + border-top-left-radius: 8px; +} + +/* @media only screen and (max-width: 1024px) { + #card-image { + background-image: url(../images/image-product-mobile.jpg); + } + #card { + margin-top: 0; + } + #container { + padding: 64px; + } +} */ + +@media only screen and (max-width: 768px) { +} + +@media only screen and (max-width: 425px) { + #card { + font-size: 32px; + height: 1000px; + margin-top: 32px; + flex-direction: column; + } + + #brand-title { + font-size: 32px; + margin-top: 20px; + margin-bottom: 20px; + } + + #title { + font-size: 32px; + } + + #card-image { + background-image: url(../images/image-product-mobile.jpg); + width: 100%; + height: 400px; + } + + #discount-price { + font-size: 56px; + } + + #real-price { + font-size: 32px; + } + + #price { + margin-top: 64px; + margin-bottom: 64px; + } + + #cart-btn { + margin: 32px 0; + height: 100px; + } +} + +@media only screen and (max-width: 325px) { +} + +.hover\:bg-neutral-dark-blue:hover{ + --tw-bg-opacity: 1; + background-color: hsl(212 21% 14% / var(--tw-bg-opacity)); +} diff --git a/product-preview-card-component/design/active-states.jpg b/product-preview-card-component/design/active-states.jpg new file mode 100644 index 0000000..0077dce Binary files /dev/null and b/product-preview-card-component/design/active-states.jpg differ diff --git a/product-preview-card-component/design/desktop-design.jpg b/product-preview-card-component/design/desktop-design.jpg new file mode 100644 index 0000000..b7e9c92 Binary files /dev/null and b/product-preview-card-component/design/desktop-design.jpg differ diff --git a/product-preview-card-component/design/desktop-preview.jpg b/product-preview-card-component/design/desktop-preview.jpg new file mode 100644 index 0000000..9884d8d Binary files /dev/null and b/product-preview-card-component/design/desktop-preview.jpg differ diff --git a/product-preview-card-component/design/mobile-design.jpg b/product-preview-card-component/design/mobile-design.jpg new file mode 100644 index 0000000..0f6da04 Binary files /dev/null and b/product-preview-card-component/design/mobile-design.jpg differ diff --git a/product-preview-card-component/images/favicon-32x32.png b/product-preview-card-component/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/product-preview-card-component/images/favicon-32x32.png differ diff --git a/product-preview-card-component/images/icon-cart.svg b/product-preview-card-component/images/icon-cart.svg new file mode 100644 index 0000000..307ea61 --- /dev/null +++ b/product-preview-card-component/images/icon-cart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/product-preview-card-component/images/image-product-desktop.jpg b/product-preview-card-component/images/image-product-desktop.jpg new file mode 100644 index 0000000..ca93ea1 Binary files /dev/null and b/product-preview-card-component/images/image-product-desktop.jpg differ diff --git a/product-preview-card-component/images/image-product-mobile.jpg b/product-preview-card-component/images/image-product-mobile.jpg new file mode 100644 index 0000000..e2076e3 Binary files /dev/null and b/product-preview-card-component/images/image-product-mobile.jpg differ diff --git a/product-preview-card-component/index.html b/product-preview-card-component/index.html new file mode 100644 index 0000000..e9fd227 --- /dev/null +++ b/product-preview-card-component/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + Frontend Mentor | Product preview card component + + +
+
+
+
+
PERFUME
+
+ Gabrielle Essence Eau De Parfum +
+
+ A floral, solar and voluptuous interpretation composed by Olivier Polge, + Perfumer-Creator for the House of CHANEL. +
+ +
+
$149.99
+
$169.99
+
+ +
+ Cart +
Add to Card
+
+
+
+
+ + diff --git a/product-preview-card-component/input.css b/product-preview-card-component/input.css new file mode 100644 index 0000000..11295bb --- /dev/null +++ b/product-preview-card-component/input.css @@ -0,0 +1,81 @@ +@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"); + +body { + font-family: "Montserrat", sans-serif; + font-optical-sizing: auto; + font-weight: 500; + font-style: normal; +} + +@tailwind base; +@tailwind components; +@tailwind utilities; + +#card { + width: 800px; + height: auto; +} + +#card-image { + background-repeat: no-repeat; + background-size: cover; + background-image: url(../images/image-product-desktop.jpg); + width: 100%; + border-bottom-left-radius: 8px; + border-top-left-radius: 8px; +} + +/* @media only screen and (max-width: 1024px) { + #card-image { + background-image: url(../images/image-product-mobile.jpg); + } + #card { + margin-top: 0; + } + #container { + padding: 64px; + } +} */ + +@media only screen and (max-width: 768px) { +} +@media only screen and (max-width: 425px) { + #card { + font-size: 32px; + height: 1000px; + margin-top: 32px; + flex-direction: column; + } + + #brand-title { + font-size: 32px; + margin-top: 20px; + margin-bottom: 20px; + } + #title { + font-size: 32px; + } + #card-image { + background-image: url(../images/image-product-mobile.jpg); + width: 100%; + height: 400px; + } + #discount-price { + font-size: 56px; + } + #real-price { + font-size: 32px; + } + #price { + margin-top: 64px; + margin-bottom: 64px; + } + + #cart-btn { + margin: 32px 0; + height: 100px; + } +} + +@media only screen and (max-width: 325px) { +} diff --git a/product-preview-card-component/package.json b/product-preview-card-component/package.json new file mode 100644 index 0000000..3f9583c --- /dev/null +++ b/product-preview-card-component/package.json @@ -0,0 +1,25 @@ +{ + "name": "product-preview-card-component", + "version": "1.0.0", + "description": "![Design preview for the Product preview card component coding challenge](./design/desktop-preview.jpg)", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "tailwind": "tailwindcss -i ./input.css -o ./assets/style.css --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/JadlionHD/frontendmentor-repo.git" + }, + "author": "JadlionHD ", + "license": "MIT", + "bugs": { + "url": "https://github.com/JadlionHD/frontendmentor-repo/issues" + }, + "homepage": "https://github.com/JadlionHD/frontendmentor-repo#readme", + "devDependencies": { + "autoprefixer": "^10.4.18", + "postcss": "^8.4.35", + "tailwindcss": "^3.4.1" + } +} diff --git a/product-preview-card-component/postcss.config.js b/product-preview-card-component/postcss.config.js new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/product-preview-card-component/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/product-preview-card-component/style-guide.md b/product-preview-card-component/style-guide.md new file mode 100644 index 0000000..55d7579 --- /dev/null +++ b/product-preview-card-component/style-guide.md @@ -0,0 +1,39 @@ +# Front-end Style Guide + +## Layout + +The designs were created to the following widths: + +- Mobile: 375px +- Desktop: 1440px + +> 💡 These are just the design sizes. Ensure content is responsive and meets WCAG requirements by testing the full range of screen sizes from 320px to large screens. + +## Colors + +### Primary + +- Dark cyan: hsl(158, 36%, 37%) +- Cream: hsl(30, 38%, 92%) + +### Neutral + +- Very dark blue: hsl(212, 21%, 14%) +- Dark grayish blue: hsl(228, 12%, 48%) +- White: hsl(0, 0%, 100%) + +## Typography + +### Body Copy + +- Font size (paragraph): 14px + +### Font + +- Family: [Montserrat](https://fonts.google.com/specimen/Montserrat) +- Weights: 500, 700 + +- Family: [Fraunces](https://fonts.google.com/specimen/Fraunces) +- Weights: 700 + +> 💎 [Upgrade to Pro](https://www.frontendmentor.io/pro?ref=style-guide) for design file access to see all design details and get hands-on experience using a professional workflow with tools like Figma. diff --git a/product-preview-card-component/tailwind.config.js b/product-preview-card-component/tailwind.config.js new file mode 100644 index 0000000..c4c56d1 --- /dev/null +++ b/product-preview-card-component/tailwind.config.js @@ -0,0 +1,18 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ["index.html"], + theme: { + extend: { + backgroundColor: { + "primary-cream": "hsl(30, 38%, 92%)", + "primary-dark-cyan": "hsl(158, 36%, 37%)" + }, + colors: { + "primary-cream": "hsl(30, 38%, 92%)", + "primary-dark-cyan": "hsl(158, 36%, 37%)", + "neutral-dark-blue": "hsl(212, 21%, 14%)" + } + } + }, + plugins: [] +};