forked from www/www-new
Add decoration to the bubble component (#152)
Closes #87 Co-authored-by: l42luo <l42luo@localhost> Co-authored-by: Linna Luo <linnaluo18@gmail.com> Reviewed-on: www/www-new#152 Reviewed-by: l42luo <l42luo@localhost> Co-authored-by: Aditya Thakral <a3thakra@csclub.uwaterloo.ca> Co-committed-by: Aditya Thakral <a3thakra@csclub.uwaterloo.ca>fix-md-font
parent
6f24b266eb
commit
41fdadb229
@ -1,7 +1,71 @@ |
||||
.bubble { |
||||
.container { |
||||
position: relative; |
||||
padding: calc(36rem / 16) 0; |
||||
overflow-x: clip; |
||||
} |
||||
|
||||
.bubble { |
||||
--border-radius: calc(5000rem / 16); |
||||
|
||||
display: flex; |
||||
flex-direction: row; |
||||
position: absolute; |
||||
top: 0; |
||||
height: 100%; |
||||
width: 100%; |
||||
justify-content: center; |
||||
align-items: flex-start; |
||||
} |
||||
|
||||
.bubble:nth-child(odd) { |
||||
.bar { |
||||
height: 100%; |
||||
width: 100%; |
||||
} |
||||
|
||||
.decoration { |
||||
display: none; |
||||
width: calc(128rem / 16); |
||||
} |
||||
|
||||
.margin { |
||||
display: none; |
||||
} |
||||
|
||||
.content { |
||||
position: relative; |
||||
z-index: 1; |
||||
} |
||||
|
||||
.container:nth-child(odd) .bar { |
||||
background-color: var(--primary-accent-light); |
||||
} |
||||
|
||||
@media only screen and (min-width: calc(1350rem / 16)) { |
||||
.container:nth-child(odd) .decoration { |
||||
display: block; |
||||
position: absolute; |
||||
} |
||||
|
||||
.container:nth-child(4n + 1) .bar { |
||||
border-top-right-radius: var(--border-radius); |
||||
border-bottom-right-radius: var(--border-radius); |
||||
transform: translateX(-12.5vw); |
||||
} |
||||
|
||||
.container:nth-child(4n + 1) .decoration { |
||||
top: calc(-50rem / 16); |
||||
right: 8vw; |
||||
} |
||||
|
||||
.container:nth-child(4n + 3) .bar { |
||||
border-top-left-radius: var(--border-radius); |
||||
border-bottom-left-radius: var(--border-radius); |
||||
transform: translateX(12.5vw); |
||||
} |
||||
|
||||
.container:nth-child(4n + 3) .decoration { |
||||
top: calc(-50rem / 16); |
||||
left: 8vw; |
||||
transform: rotateY(180deg); |
||||
} |
||||
} |
||||
|
@ -1,13 +1,24 @@ |
||||
import React from "react"; |
||||
|
||||
import { Image } from "@/components/Image"; |
||||
|
||||
import { DefaultLayout } from "./DefaultLayout"; |
||||
|
||||
import styles from "./Bubble.module.css"; |
||||
|
||||
export default function Bubble(props: { children: React.ReactNode }) { |
||||
return ( |
||||
<div className={styles.bubble}> |
||||
<DefaultLayout>{props.children}</DefaultLayout> |
||||
<div className={styles.container}> |
||||
<div className={styles.bubble} aria-hidden> |
||||
<div className={styles.bar} /> |
||||
<Image |
||||
className={styles.decoration} |
||||
src="/images/bubble-decoration.svg" |
||||
/> |
||||
</div> |
||||
<div className={styles.content}> |
||||
<DefaultLayout>{props.children}</DefaultLayout> |
||||
</div> |
||||
</div> |
||||
); |
||||
} |
||||
|
After Width: | Height: | Size: 906 B |
Loading…
Reference in new issue