Skip to content

Commit 85faaaa

Browse files
committed
Merge branch 'main' into improve-stories
2 parents 62bb809 + 9fe794a commit 85faaaa

File tree

4 files changed

+53
-23
lines changed

4 files changed

+53
-23
lines changed

src/components/Button.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,31 @@ import { ReactNode } from 'react'
33
type ButtonProps = {
44
children: ReactNode
55
onClick?: () => void
6+
color?: 'primary' | 'secondary' | 'transparent'
7+
variant?: 'contained' | 'outlined' | 'text'
68
}
79

8-
const Button = ({ children, onClick: onClick }: ButtonProps) => {
10+
const Button = ({
11+
children,
12+
onClick: onClick,
13+
color = 'primary',
14+
variant = 'contained',
15+
}: ButtonProps) => {
16+
const getColorStyles = (color: string) => {
17+
if (color === 'primary') {
18+
return 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800'
19+
}
20+
if (color === 'transparent') {
21+
return 'focus:ring-transparent'
22+
}
23+
return ''
24+
}
925
return (
1026
<button
1127
type="button"
12-
className="text-white font-bold bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
28+
className={` focus:ring-4 rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2 ${getColorStyles(
29+
color
30+
)} `}
1331
onClick={onClick}
1432
>
1533
{children}

src/components/UserDetails/Badges/Hexagon.tsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,10 @@ export enum hexagonBackground {
1515

1616
export default function Hexagon({ children, size, color }: any) {
1717
return (
18-
<div className="border-container">
19-
<div className={`hexagon-container ${color}`}>
20-
<div className="content">{children}</div>
21-
</div>
18+
<div className={`hexagon-container ${color}`}>
19+
<div className="content">{children}</div>
2220
<style jsx>
2321
{`
24-
.border-container {
25-
position: relative;
26-
display: flex;
27-
justify-content: center;
28-
align-items: center;
29-
width: ${size * 0.645 * 1.1}rem;
30-
height: ${size * 1.1}rem;
31-
background: #ddd;
32-
border-radius: ${size / 8}rem;
33-
}
3422
.hexagon-container {
3523
position: relative;
3624
width: ${size * 0.645}rem;
@@ -39,14 +27,13 @@ export default function Hexagon({ children, size, color }: any) {
3927
display: flex;
4028
justify-content: center;
4129
align-items: center;
30+
filter: drop-shadow(0.25rem 0.25rem 0.25rem rgba(0, 0, 0, 0.5));
4231
}
4332
.hexagon-container,
4433
.hexagon-container:before,
4534
.hexagon-container:after {
4635
z-index: 1;
4736
}
48-
.border-container:before,
49-
.border-container:after,
5037
.hexagon-container:before,
5138
.hexagon-container:after {
5239
position: absolute;
@@ -61,11 +48,9 @@ export default function Hexagon({ children, size, color }: any) {
6148
bottom: 0;
6249
margin: auto;
6350
}
64-
.border-container:before,
6551
.hexagon-container:before {
6652
transform: rotate(60deg);
6753
}
68-
.border-container:after,
6954
.hexagon-container:after {
7055
transform: rotate(-60deg);
7156
}

src/components/comment/Comments.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { graphql, usePaginationFragment } from 'react-relay'
2-
import { Comments_story$key } from '../../queries/__generated__/Comments_story.graphql'
32
import NewComment from './NewComment'
43
import Comment from './Comment'
54

65
type CommentsProps = {
7-
story: Comments_story$key
6+
story: any
87
}
98

109
const Comments = ({ story }: CommentsProps) => {

src/components/navbar/ThemeButton.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,33 @@ export default function ThemeButton() {
2121
setDarkMode(!darkMode)
2222
}
2323

24-
return <Button onClick={onClick}>toggle dark mode</Button>
24+
return (
25+
<Button onClick={onClick} color="transparent">
26+
{darkMode ? (
27+
<svg
28+
id="day"
29+
xmlns="http://www.w3.org/2000/svg"
30+
width="24"
31+
height="24"
32+
style={{ fill: '#fff' }}
33+
>
34+
<path d="M18.1 5.1c0 .3-.1.6-.3.9l-1.4 1.4-.9-.8 2.2-2.2c.3.1.4.4.4.7zm-.5 5.3h3.2c0 .3-.1.6-.4.9s-.5.4-.8.4h-2v-1.3zm-6.2-5V2.2c.3 0 .6.1.9.4s.4.5.4.8v2h-1.3zm6.4 11.7c-.3 0-.6-.1-.8-.3l-1.4-1.4.8-.8 2.2 2.2c-.2.2-.5.3-.8.3zM6.2 4.9c.3 0 .6.1.8.3l1.4 1.4-.8.9-2.2-2.3c.2-.2.5-.3.8-.3zm5.2 11.7h1.2v3.2c-.3 0-.6-.1-.9-.4s-.4-.5-.4-.8l.1-2zm-7-6.2h2v1.2H3.2c0-.3.1-.6.4-.9s.5-.3.8-.3zM6.2 16l1.4-1.4.8.8-2.2 2.2c-.2-.2-.3-.5-.3-.8s.1-.6.3-.8z" />
35+
<circle cx="12" cy="11" r="4" />
36+
</svg>
37+
) : (
38+
<svg
39+
id="night"
40+
xmlns="http://www.w3.org/2000/svg"
41+
width="24"
42+
height="24"
43+
viewBox="0 0 24 24"
44+
>
45+
<path
46+
d="M19.1 17.5c-3.3 1.4-7.1-.2-8.5-3.5-1.4-3.3.2-7.1 3.5-8.5.2-.1.5-.2.7-.3-1.6-.4-3.2-.3-4.8.4C6 7.3 4 12 5.7 16c1.7 4.1 6.4 6 10.5 4.3 1.7-.7 3-1.9 3.8-3.4-.3.3-.6.4-.9.6z"
47+
fill="#444;"
48+
/>
49+
</svg>
50+
)}
51+
</Button>
52+
)
2553
}

0 commit comments

Comments
 (0)