-
Notifications
You must be signed in to change notification settings - Fork 11
Refactor scss CardContainer #280
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e5713f0
Migrate card container components to SCSS
shayla-develops-webs 029bd9f
Replace BlogCard with Card to fix build error
shayla-develops-webs bab09ab
update media queries to use SCSS mixins in cards
shayla-develops-webs 1a69068
fixed conflicts
shayla-develops-webs 2ee07ac
resolved blog title text issue, removed redundant .title property and…
shayla-develops-webs bf7b71d
add new small-mobile-min variable and update cards scss to reflect.
shayla-develops-webs b88a144
Merge branch 'main' of https://github.com/Web-Dev-Path/web-dev-path i…
shayla-develops-webs 04ebe97
fixed build error
shayla-develops-webs d2e727b
Merge branch 'main' of https://github.com/Web-Dev-Path/web-dev-path i…
shayla-develops-webs 37a6cf7
remove important directive. doesn't appear to cause any override issues
shayla-develops-webs 13adcfd
Merge branch 'main' of https://github.com/Web-Dev-Path/web-dev-path i…
shayla-develops-webs 5c294bf
remove tablet rule
shayla-develops-webs 94a02c5
resolve build error
shayla-develops-webs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| @use '@/styles/index' as *; | ||
|
|
||
| // Base Card | ||
| .card { | ||
| margin: 1rem 1rem 0 0.5rem; | ||
| padding: 1.5rem; | ||
| border-radius: 1.5rem; | ||
| box-shadow: var(--shadow-default); | ||
| min-width: 32%; | ||
| height: 37rem; | ||
|
|
||
| a { | ||
| text-decoration: underline; | ||
| text-underline-offset: 2px; | ||
|
|
||
| &:hover { | ||
| opacity: 0.6; | ||
| text-decoration: none; | ||
| } | ||
| } | ||
|
|
||
| @include small-mobile-min { | ||
| height: 42rem; | ||
| } | ||
|
|
||
| @include desktop { | ||
| height: 37rem; | ||
| margin: 1.5rem 1.5rem 0 1.5rem; | ||
|
|
||
| &:first-child, | ||
| &:last-child { | ||
| margin: 1.5rem 0.5rem 0 0.5rem; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .title { | ||
| font-family: $font-family-secondary; | ||
| font-weight: bold; | ||
| font-size: 1.75rem; | ||
| color: var(--color-primary-content); | ||
| margin: 1rem 0 0 0; | ||
| line-height: unset; | ||
|
|
||
| @include tablet { | ||
| font-size: 2.25rem; | ||
| } | ||
| } | ||
|
|
||
| .contentWrapper { | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .imageWrapper { | ||
| width: 100%; | ||
| height: 18rem; | ||
| position: relative; | ||
| } | ||
|
|
||
| .cardImage { | ||
| border-radius: 0.25rem; | ||
| object-fit: cover; | ||
| } | ||
|
|
||
| .tagContainer { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| max-height: 12rem; | ||
| overflow: hidden; | ||
| gap: 0.5rem; | ||
| margin-bottom: -1rem; | ||
|
|
||
| a { | ||
| text-decoration: none; | ||
| } | ||
| } | ||
|
|
||
| // About Us Card Variant | ||
| .card--about { | ||
| background-color: var(--color-primary-accent); | ||
| max-height: 35rem; | ||
|
|
||
| @include desktop { | ||
| max-height: 37rem; | ||
| } | ||
|
|
||
| .title { | ||
| @extend .title; | ||
| font-size: 3.5rem; | ||
| text-align: center; | ||
|
|
||
| @include desktop { | ||
| font-size: 5rem; | ||
| } | ||
| } | ||
|
|
||
| .contentWrapper { | ||
| @include desktop { | ||
| p { | ||
| font-size: 1.8rem; | ||
| line-height: 2.2rem; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Contact Card Variant | ||
| .card--contact { | ||
| height: 27rem; | ||
| background-color: var(--color-white); | ||
|
|
||
| @include desktop { | ||
| height: 25rem; | ||
| } | ||
|
|
||
| .imageWrapper { | ||
| width: auto; | ||
| position: relative; | ||
| height: 5rem; | ||
| margin-right: 75%; | ||
| margin-top: 3rem; | ||
| margin-bottom: 3rem; | ||
| } | ||
|
|
||
| .cardImage { | ||
| margin: 0; | ||
| position: absolute; | ||
| object-fit: contain; | ||
| } | ||
| } | ||
|
|
||
| // Blog Card Variant | ||
| .card--blog { | ||
| margin: 1rem 0.5rem 0 0.5rem; | ||
|
|
||
| @include tablet { | ||
| height: 40rem; | ||
| } | ||
|
|
||
| .title { | ||
| @extend .title; | ||
| font-size: 1.3rem; | ||
| margin-bottom: 0.7rem; | ||
| max-height: 7rem; | ||
| overflow: hidden; | ||
|
|
||
| @include tablet { | ||
| font-size: 1.3rem; | ||
| } | ||
| } | ||
|
|
||
| .imageWrapper { | ||
| height: 12rem; | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,48 @@ | ||
| import { CardInterface } from './CardInterface'; | ||
| import { CardStyles } from './styles'; | ||
| import { Tag } from '@/components/blog/Tag'; | ||
| import Link from 'next/link'; | ||
| import Image from 'next/image'; | ||
| import styles from './Cards.module.scss'; | ||
|
|
||
| export function Card({ card }) { | ||
| return <CardInterface card={card} styledComponents={CardStyles} />; | ||
| export function Card({ card, cardType = 'default' }) { | ||
| const { image, altTag, title, content, link, linkText, tagList } = card; | ||
|
|
||
| const LinkComponent = link?.startsWith('http') ? ( | ||
| <a href={link} target='_blank' rel='noopener noreferrer'> | ||
| {linkText} | ||
| </a> | ||
| ) : ( | ||
| link && <Link href={link}>{linkText}</Link> | ||
| ); | ||
|
|
||
| return ( | ||
| <div className={`${styles.card} ${styles[`card--${cardType}`] || ''}`}> | ||
| {image && ( | ||
| <div className={styles.imageWrapper}> | ||
| <Image className={styles.cardImage} src={image} alt={altTag} fill /> | ||
| </div> | ||
| )} | ||
|
|
||
| {title && ( | ||
| <h2 className={styles.title} title={title}> | ||
| {title} | ||
| </h2> | ||
| )} | ||
|
|
||
| {tagList?.length > 0 && ( | ||
| <div className={styles.tagContainer}> | ||
| {tagList.slice(0, 8).map((tag, i) => ( | ||
| <Tag key={i} text={tag} /> | ||
| ))} | ||
| </div> | ||
| )} | ||
|
|
||
| {content && ( | ||
| <div className={styles.contentWrapper}> | ||
| <p> | ||
| {content} {LinkComponent} | ||
| </p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.