cherry-styled-components 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/.eslintrc.cjs +18 -0
  3. package/.prettierrc +11 -0
  4. package/.supermaven/config.json +1 -0
  5. package/README.md +33 -11
  6. package/dist/App.d.ts +2 -0
  7. package/dist/cherry.js +5174 -0
  8. package/dist/cherry.umd.cjs +1217 -0
  9. package/dist/lib/box.d.ts +4 -0
  10. package/dist/lib/button.d.ts +15 -0
  11. package/dist/lib/col.d.ts +16 -0
  12. package/dist/lib/container.d.ts +19 -0
  13. package/dist/lib/flex.d.ts +29 -0
  14. package/dist/lib/grid.d.ts +24 -0
  15. package/dist/lib/index.d.ts +15 -0
  16. package/dist/lib/input.d.ts +26 -0
  17. package/dist/lib/max-width.d.ts +14 -0
  18. package/dist/lib/range.d.ts +13 -0
  19. package/dist/lib/select.d.ts +15 -0
  20. package/dist/lib/space.d.ts +14 -0
  21. package/dist/lib/styled-components/index.d.ts +2 -0
  22. package/dist/lib/styled-components/registry.d.ts +5 -0
  23. package/dist/lib/styled-components/theme-provider.d.ts +12 -0
  24. package/dist/lib/textarea.d.ts +14 -0
  25. package/dist/lib/toggle.d.ts +14 -0
  26. package/dist/lib/utils/global.d.ts +3 -0
  27. package/dist/lib/utils/icons.d.ts +9 -0
  28. package/dist/lib/utils/index.d.ts +5 -0
  29. package/dist/lib/utils/mixins.d.ts +11 -0
  30. package/dist/lib/utils/theme.d.ts +231 -0
  31. package/dist/lib/utils/typography.d.ts +20 -0
  32. package/dist/main.d.ts +1 -0
  33. package/dist/toggle-theme.d.ts +3 -0
  34. package/index.html +13 -0
  35. package/package.json +37 -24
  36. package/pnpm-workspace.yaml +3 -0
  37. package/src/App.tsx +80 -0
  38. package/src/lib/box.tsx +26 -0
  39. package/src/lib/button.tsx +162 -0
  40. package/src/lib/col.tsx +45 -0
  41. package/src/lib/container.tsx +59 -0
  42. package/src/lib/flex.tsx +92 -0
  43. package/src/lib/grid.tsx +64 -0
  44. package/src/{app/components/cherry → lib}/index.ts +15 -15
  45. package/src/lib/input.tsx +384 -0
  46. package/src/lib/max-width.tsx +50 -0
  47. package/src/lib/range.tsx +208 -0
  48. package/src/lib/select.tsx +121 -0
  49. package/src/lib/space.tsx +52 -0
  50. package/src/{app/components/cherry → lib}/styled-components/index.ts +2 -2
  51. package/src/lib/styled-components/registry.tsx +26 -0
  52. package/src/lib/styled-components/theme-provider.tsx +49 -0
  53. package/src/lib/textarea.tsx +94 -0
  54. package/src/lib/toggle.tsx +147 -0
  55. package/src/{app/components/cherry → lib}/utils/global.tsx +95 -78
  56. package/src/lib/utils/icons.tsx +84 -0
  57. package/src/{app/components/cherry → lib}/utils/index.ts +5 -5
  58. package/src/lib/utils/mixins.tsx +95 -0
  59. package/src/lib/utils/theme.ts +289 -0
  60. package/src/lib/utils/typography.tsx +204 -0
  61. package/src/main.tsx +14 -0
  62. package/src/toggle-theme.tsx +25 -0
  63. package/src/vite-env.d.ts +8 -0
  64. package/tsconfig.json +24 -0
  65. package/vite.config.js +24 -0
  66. package/src/app/components/cherry/box.tsx +0 -16
  67. package/src/app/components/cherry/button.tsx +0 -177
  68. package/src/app/components/cherry/col.tsx +0 -39
  69. package/src/app/components/cherry/container.tsx +0 -55
  70. package/src/app/components/cherry/flex.tsx +0 -90
  71. package/src/app/components/cherry/grid.tsx +0 -60
  72. package/src/app/components/cherry/input.tsx +0 -254
  73. package/src/app/components/cherry/max-width.tsx +0 -43
  74. package/src/app/components/cherry/range.tsx +0 -223
  75. package/src/app/components/cherry/select.tsx +0 -122
  76. package/src/app/components/cherry/space.tsx +0 -54
  77. package/src/app/components/cherry/styled-components/registry.tsx +0 -26
  78. package/src/app/components/cherry/styled-components/theme-provider.tsx +0 -21
  79. package/src/app/components/cherry/textarea.tsx +0 -98
  80. package/src/app/components/cherry/toggle.tsx +0 -148
  81. package/src/app/components/cherry/utils/icons.tsx +0 -168
  82. package/src/app/components/cherry/utils/mixins.tsx +0 -107
  83. package/src/app/components/cherry/utils/theme.ts +0 -241
  84. package/src/app/components/cherry/utils/typography.tsx +0 -204
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import React, { forwardRef } from "react";
3
+ import styled, { IStyledComponent } from "styled-components";
4
+ import {
5
+ Theme,
6
+ IconArrow,
7
+ formElementHeightStyles,
8
+ fullWidthStyles,
9
+ resetButton,
10
+ resetInput,
11
+ statusBorderStyles,
12
+ } from "./utils";
13
+ import { StyledInputWrapper, StyledLabel } from "./input";
14
+
15
+ interface SelectProps extends React.InputHTMLAttributes<HTMLSelectElement> {
16
+ children?: React.ReactNode;
17
+ $label?: string;
18
+ $size?: "default" | "big";
19
+ $error?: boolean;
20
+ $success?: boolean;
21
+ $fullWidth?: boolean;
22
+ theme?: Theme;
23
+ }
24
+
25
+ const StyledSelect = styled.select<SelectProps>`
26
+ ${resetButton};
27
+ ${resetInput};
28
+ font-family: inherit;
29
+ display: inline-block;
30
+ padding: 0 15px;
31
+ border-radius: ${({ theme }) => theme.spacing.radius.xs};
32
+ font-weight: 400;
33
+ white-space: nowrap;
34
+ hyphens: auto;
35
+ color: ${({ theme }) => theme.colors.dark};
36
+ background: ${({ theme }) => theme.colors.light};
37
+ border: solid 2px ${({ theme }) => theme.colors.grayLight};
38
+ box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primaryLight};
39
+ transition: all 0.3s ease;
40
+
41
+ &::placeholder {
42
+ color: ${({ theme }) => theme.colors.gray};
43
+ }
44
+
45
+ @media (hover: hover) {
46
+ &:hover:not([disabled]) {
47
+ border-color: ${({ theme }) => theme.colors.primary};
48
+ }
49
+ }
50
+
51
+ &:focus:not([disabled]) {
52
+ box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
53
+ border-color: ${({ theme }) => theme.colors.primary};
54
+ }
55
+
56
+ &:active:not([disabled]) {
57
+ box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
58
+ }
59
+
60
+ ${({ $size }) => formElementHeightStyles($size)}
61
+
62
+ ${({ $size, theme }) =>
63
+ $size === "big"
64
+ ? `font-size: ${theme.fontSizes.inputBig.lg};`
65
+ : `font-size: ${theme.fontSizes.input.lg};`}
66
+
67
+ ${({ $error, $success, theme }) => {
68
+ return statusBorderStyles($error ? true : false, $success ? true : false, theme);
69
+ }}
70
+
71
+ ${({ disabled, theme }) =>
72
+ disabled &&
73
+ `cursor: not-allowed;
74
+ background: ${theme.colors.grayLight};
75
+ border-color: ${theme.colors.gray};
76
+ color: ${theme.colors.gray};
77
+ `}
78
+
79
+ ${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
80
+ `;
81
+
82
+ export const StyledIconWrapper: IStyledComponent<"web", SelectProps> = styled.span<SelectProps>`
83
+ position: relative;
84
+ ${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
85
+
86
+ & svg {
87
+ position: absolute;
88
+ top: 50%;
89
+ right: 15px;
90
+ transform: translateY(-50%) rotate(0);
91
+ transition: all 0.3s ease;
92
+ pointer-events: none;
93
+ }
94
+
95
+ & select {
96
+ padding-right: 40px;
97
+ }
98
+
99
+ & select:active:not([disabled]) ~ svg,
100
+ & select:focus:not([disabled]) ~ svg {
101
+ transform: translateY(-50%) rotate(180deg);
102
+ }
103
+ `;
104
+
105
+ function LocalSelect({ ...props }: SelectProps, ref: React.Ref<HTMLSelectElement>) {
106
+ return (
107
+ <StyledInputWrapper $fullWidth={props.$fullWidth} $label={props.$label}>
108
+ {props.$label && <StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>}
109
+ <StyledIconWrapper $fullWidth={props.$fullWidth}>
110
+ <StyledSelect {...props} ref={ref}>
111
+ {props.children}
112
+ </StyledSelect>
113
+ <IconArrow />
114
+ </StyledIconWrapper>
115
+ </StyledInputWrapper>
116
+ );
117
+ }
118
+
119
+ const Select = forwardRef(LocalSelect);
120
+
121
+ export { Select };
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import React, { forwardRef } from "react";
3
+ import styled from "styled-components";
4
+ import { Breakpoints, mq } from "./utils";
5
+
6
+ interface SpaceProps {
7
+ $size?: number | "none";
8
+ $xs?: number | "none";
9
+ $sm?: number | "none";
10
+ $md?: number | "none";
11
+ $lg?: number | "none";
12
+ $xl?: number | "none";
13
+ $xxl?: number | "none";
14
+ $xxxl?: number | "none";
15
+ $horizontal?: boolean;
16
+ }
17
+
18
+ const styles = ($size: number | "none", $horizontal: boolean) =>
19
+ $horizontal
20
+ ? `display: inline-block;
21
+ max-height: 0;
22
+ min-width: ${$size}px;
23
+ max-width: ${$size}px;`
24
+ : `display: block;
25
+ min-height: ${$size}px;
26
+ max-height: ${$size}px;`;
27
+
28
+ function responsiveStyles(props: any) {
29
+ return Object.keys(props)
30
+ .filter((key) => key.startsWith("$"))
31
+ .map((key) => {
32
+ const size = key.substring(1) as keyof Breakpoints<number>;
33
+ return props[key] && mq(size) + `{ ${styles(props[key], props.$horizontal || false)} }`;
34
+ })
35
+ .join("");
36
+ }
37
+
38
+ const StyledSpace = styled.span<SpaceProps>`
39
+ ${({ $horizontal, $size }) => `
40
+ ${$size && $size !== "none" && styles($size, $horizontal || false)};
41
+ ${$size === "none" && `display: none;`};
42
+ `}
43
+ ${(props) => responsiveStyles(props)}
44
+ `;
45
+
46
+ function LocalSpace({ ...props }: SpaceProps, ref: React.Ref<HTMLSpanElement>) {
47
+ return <StyledSpace {...props} ref={ref} />;
48
+ }
49
+
50
+ const Space = forwardRef(LocalSpace);
51
+
52
+ export { Space };
@@ -1,2 +1,2 @@
1
- export * from "./registry";
2
- export * from "./theme-provider";
1
+ export * from "./registry";
2
+ export * from "./theme-provider";
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import React, { useState } from "react";
3
+ import { useServerInsertedHTML } from "next/navigation";
4
+ import { ServerStyleSheet, StyleSheetManager } from "styled-components";
5
+
6
+ function StyledComponentsRegistry({ children }: { children: React.ReactNode }) {
7
+ // Only create stylesheet once with lazy initial state
8
+ // x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
9
+ const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet());
10
+
11
+ useServerInsertedHTML(() => {
12
+ const styles = styledComponentsStyleSheet.getStyleElement();
13
+ styledComponentsStyleSheet.instance.clearTag();
14
+ return <>{styles}</>;
15
+ });
16
+
17
+ if (typeof window !== "undefined") return <>{children}</>;
18
+
19
+ return (
20
+ <StyleSheetManager sheet={styledComponentsStyleSheet.instance} enableVendorPrefixes>
21
+ {children}
22
+ </StyleSheetManager>
23
+ );
24
+ }
25
+
26
+ export { StyledComponentsRegistry };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import React, { createContext, useEffect, useState } from "react";
3
+ import { ThemeProvider as StyledThemeProvider } from "styled-components";
4
+ import { GlobalStyles, Theme } from "../utils";
5
+
6
+ interface ThemeContextProps {
7
+ setTheme: any;
8
+ }
9
+
10
+ export const ThemeContext = createContext<ThemeContextProps>({
11
+ setTheme: null,
12
+ });
13
+
14
+ function CherryThemeProvider({
15
+ children,
16
+ theme,
17
+ themeDark,
18
+ }: {
19
+ children: React.ReactNode;
20
+ theme: Theme;
21
+ themeDark?: Theme;
22
+ }) {
23
+ const [currentTheme, setTheme] = useState(theme);
24
+ useEffect(() => {
25
+ if (!themeDark) return setTheme(theme);
26
+ if (
27
+ localStorage.theme === "dark" ||
28
+ (!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
29
+ ) {
30
+ document.documentElement.classList.add("dark");
31
+ setTheme(themeDark);
32
+ } else {
33
+ document.documentElement.classList.remove("dark");
34
+ setTheme(theme);
35
+ }
36
+ }, []);
37
+ const GlobalStylesComponent = GlobalStyles(currentTheme);
38
+
39
+ return (
40
+ <StyledThemeProvider theme={currentTheme}>
41
+ <ThemeContext.Provider value={{ setTheme }}>
42
+ <GlobalStylesComponent />
43
+ {children}
44
+ </ThemeContext.Provider>
45
+ </StyledThemeProvider>
46
+ );
47
+ }
48
+
49
+ export { CherryThemeProvider };
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import React, { forwardRef } from "react";
3
+ import styled from "styled-components";
4
+ import { Theme, fullWidthStyles, resetButton, resetInput, statusBorderStyles } from "./utils";
5
+ import { StyledInputWrapper, StyledLabel } from "./input";
6
+
7
+ interface TextareaProps extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "size"> {
8
+ children?: React.ReactNode;
9
+ $label?: string;
10
+ $size?: "default" | "big";
11
+ $error?: boolean;
12
+ $success?: boolean;
13
+ $fullWidth?: boolean;
14
+ theme?: Theme;
15
+ rows?: number;
16
+ }
17
+
18
+ const StyledTextarea = styled.textarea<TextareaProps>`
19
+ ${resetButton};
20
+ ${resetInput};
21
+ font-family: inherit;
22
+ display: inline-block;
23
+ padding: 15px;
24
+ border-radius: ${({ theme }) => theme.spacing.radius.xs};
25
+ font-weight: 400;
26
+ white-space: break-spaces;
27
+ hyphens: none;
28
+ color: ${({ theme }) => theme.colors.dark};
29
+ background: ${({ theme }) => theme.colors.light};
30
+ border: solid 2px ${({ theme }) => theme.colors.grayLight};
31
+ box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primaryLight};
32
+ transition: all 0.3s ease;
33
+ min-height: 80px;
34
+
35
+ &::placeholder {
36
+ color: ${({ theme }) => theme.colors.gray};
37
+ }
38
+
39
+ @media (hover: hover) {
40
+ &:hover:not([disabled]) {
41
+ border-color: ${({ theme }) => theme.colors.primary};
42
+ }
43
+ }
44
+
45
+ &:focus:not([disabled]) {
46
+ box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
47
+ border-color: ${({ theme }) => theme.colors.primary};
48
+ }
49
+
50
+ &:active:not([disabled]) {
51
+ box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
52
+ }
53
+
54
+ ${({ $size, theme }) =>
55
+ $size === "big"
56
+ ? `font-size: ${theme.fontSizes.inputBig.lg};
57
+ line-height: ${theme.lineHeights.text.lg};
58
+ `
59
+ : `font-size: ${theme.fontSizes.input.lg};
60
+ line-height: ${theme.lineHeights.text.lg};`}
61
+
62
+ ${({ $error, $success, theme }) => {
63
+ return statusBorderStyles($error ? true : false, $success ? true : false, theme);
64
+ }}
65
+
66
+ ${({ disabled, theme }) =>
67
+ disabled &&
68
+ `cursor: not-allowed;
69
+ background: ${theme.colors.grayLight};
70
+ border-color: ${theme.colors.gray};
71
+ color: ${theme.colors.gray};
72
+ `}
73
+
74
+ ${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
75
+ `;
76
+
77
+ function LocalTextarea({ ...props }: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {
78
+ return (
79
+ <StyledInputWrapper $fullWidth={props.$fullWidth} $label={props.$label}>
80
+ {props.$label && (
81
+ <StyledLabel htmlFor={props.id} $label={props.$label}>
82
+ {props.$label}
83
+ </StyledLabel>
84
+ )}
85
+ <StyledTextarea {...props} ref={ref}>
86
+ {props.children}
87
+ </StyledTextarea>
88
+ </StyledInputWrapper>
89
+ );
90
+ }
91
+
92
+ const Textarea = forwardRef(LocalTextarea);
93
+
94
+ export { Textarea };
@@ -0,0 +1,147 @@
1
+ "use client";
2
+ import React, { forwardRef } from "react";
3
+ import styled from "styled-components";
4
+ import { Theme, resetButton, statusBorderStyles } from "./utils";
5
+ import { StyledInputWrapper, StyledLabel } from "./input";
6
+
7
+ interface ToggleProps extends React.InputHTMLAttributes<HTMLInputElement> {
8
+ children?: React.ReactNode;
9
+ type?: "checkbox" | "radio";
10
+ $label?: string;
11
+ $size?: "default" | "big";
12
+ $error?: boolean;
13
+ $success?: boolean;
14
+ $fullWidth?: boolean;
15
+ theme?: Theme;
16
+ }
17
+
18
+ const StyledToggleWrapper = styled.span<ToggleProps>`
19
+ display: inline-block;
20
+ margin: auto 0;
21
+ position: relative;
22
+ vertical-align: middle;
23
+ `;
24
+
25
+ const StyledFakeToggle = styled.span<ToggleProps>`
26
+ display: block;
27
+ border: solid 2px ${({ theme }) => theme.colors.grayLight};
28
+ background: ${({ theme }) => theme.colors.light};
29
+ border-radius: ${({ theme }) => theme.spacing.radius.xl};
30
+ pointer-events: none;
31
+ transition: all 0.3s ease;
32
+ box-shadow: 0 0 0 0 ${({ theme }) => theme.colors.primaryLight};
33
+ transform: none;
34
+ width: ${({ $size }) => ($size === "big" ? "56px" : "46px")};
35
+ height: ${({ $size }) => ($size === "big" ? "32px" : "22px")};
36
+
37
+ ${({ $error, $success, theme }) => {
38
+ return statusBorderStyles($error ? true : false, $success ? true : false, theme);
39
+ }}
40
+
41
+ &::before,
42
+ &::after {
43
+ content: "";
44
+ display: block;
45
+ position: absolute;
46
+ }
47
+
48
+ &::before {
49
+ top: 5px;
50
+ left: 5px;
51
+ width: calc(100% - 10px);
52
+ height: calc(100% - 10px);
53
+ max-width: 0;
54
+ border-radius: ${({ theme }) => theme.spacing.radius.xl};
55
+ background: ${({ theme }) => theme.colors.light};
56
+ transition: all 0.3s ease;
57
+ }
58
+
59
+ &::after {
60
+ left: 0;
61
+ top: 0;
62
+ border-radius: 50%;
63
+ transition: all 0.3s ease;
64
+ transform: translateX(0);
65
+ background: ${({ theme }) => theme.colors.primary};
66
+ width: ${({ $size }) => ($size === "big" ? "32px" : "22px")};
67
+ height: ${({ $size }) => ($size === "big" ? "32px" : "22px")};
68
+ }
69
+ `;
70
+
71
+ const StyledToggle = styled.input<ToggleProps>`
72
+ ${resetButton};
73
+ position: absolute;
74
+ left: 0;
75
+ top: 0;
76
+ width: 100%;
77
+ height: 100%;
78
+ outline: none;
79
+ z-index: 10;
80
+
81
+ &:checked ~ .fake-toggle {
82
+ &::before {
83
+ max-width: 46px;
84
+ background: ${({ theme }) => theme.colors.primaryLight};
85
+ }
86
+
87
+ &::after {
88
+ transform: translateX(25px);
89
+ }
90
+ }
91
+
92
+ @media (hover: hover) {
93
+ &:hover:not([disabled]) ~ .fake-toggle {
94
+ border-color: ${({ theme }) => theme.colors.primary};
95
+ }
96
+ }
97
+
98
+ &:focus:not([disabled]) ~ .fake-toggle {
99
+ outline: none;
100
+ border-color: ${({ theme }) => theme.colors.primary};
101
+ box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
102
+ }
103
+
104
+ &:active:not([disabled]) ~ .fake-toggle {
105
+ box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
106
+ }
107
+
108
+ ${({ disabled, theme }) =>
109
+ disabled &&
110
+ `cursor: not-allowed;
111
+
112
+ & ~ .fake-toggle {
113
+ border-color: ${theme.colors.gray};
114
+
115
+ &::before {
116
+ background: ${theme.colors.grayLight};
117
+ }
118
+
119
+ &::after {
120
+ background: ${theme.colors.gray};
121
+ }
122
+ }`}
123
+ `;
124
+
125
+ function LocalToggle(
126
+ { type = "checkbox", ...props }: ToggleProps,
127
+ ref: React.Ref<HTMLInputElement>,
128
+ ) {
129
+ return (
130
+ <StyledInputWrapper $fullWidth={props.$fullWidth} $label={props.$label}>
131
+ <StyledToggleWrapper>
132
+ <StyledToggle {...props} type={type} ref={ref} />
133
+ <StyledFakeToggle
134
+ $error={props.$error}
135
+ $success={props.$success}
136
+ className="fake-toggle"
137
+ $size={props.$size}
138
+ />
139
+ </StyledToggleWrapper>
140
+ {props.$label && <StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>}
141
+ </StyledInputWrapper>
142
+ );
143
+ }
144
+
145
+ const Toggle = forwardRef(LocalToggle);
146
+
147
+ export { Toggle };
@@ -1,78 +1,95 @@
1
- "use client";
2
- import { createGlobalStyle } from "styled-components";
3
-
4
- const GlobalStyles = createGlobalStyle`
5
- html,
6
- body {
7
- margin: 0;
8
- padding: 0;
9
- min-height: 100%;
10
- scroll-behavior: smooth;
11
- }
12
-
13
- body {
14
- -moz-osx-font-smoothing: grayscale;
15
- -webkit-text-size-adjust: 100%;
16
- -webkit-font-smoothing: antialiased;
17
- }
18
-
19
- * {
20
- box-sizing: border-box;
21
- min-width: 0;
22
- }
23
-
24
- pre,
25
- code,
26
- kbd,
27
- samp {
28
- font-family: monospace, monospace;
29
- }
30
-
31
- pre,
32
- code,
33
- kbd,
34
- samp,
35
- blockquote,
36
- p,
37
- a,
38
- h1,
39
- h2,
40
- h3,
41
- h4,
42
- h5,
43
- h6 {
44
- margin: 0;
45
- padding: 0;
46
- }
47
-
48
- ol,
49
- ul {
50
- list-style: none;
51
- margin: 0;
52
- padding: 0;
53
- }
54
-
55
- figure {
56
- margin: 0;
57
- }
58
-
59
- fieldset {
60
- appearance: none;
61
- border: none;
62
- }
63
-
64
- button,
65
- input,
66
- a,
67
- img,
68
- svg,
69
- svg * {
70
- transition: all 0.3s ease;
71
- }
72
-
73
- strong,
74
- b {
75
- font-weight: 700;
76
- }`;
77
-
78
- export { GlobalStyles };
1
+ "use client";
2
+ import { createGlobalStyle } from "styled-components";
3
+ import { Theme } from "./theme";
4
+
5
+ const GlobalStyles = (theme: Theme) => createGlobalStyle`
6
+ html,
7
+ body {
8
+ margin: 0;
9
+ padding: 0;
10
+ min-height: 100%;
11
+ scroll-behavior: smooth;
12
+ background-color: ${theme.colors.light};
13
+ }
14
+
15
+ body {
16
+ font-family: "Inter", sans-serif;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ -webkit-text-size-adjust: 100%;
19
+ -webkit-font-smoothing: antialiased;
20
+ }
21
+
22
+ * {
23
+ box-sizing: border-box;
24
+ min-width: 0;
25
+ }
26
+
27
+ pre,
28
+ code,
29
+ kbd,
30
+ samp {
31
+ font-family: monospace, monospace;
32
+ }
33
+
34
+ pre,
35
+ code,
36
+ kbd,
37
+ samp,
38
+ blockquote,
39
+ p,
40
+ a,
41
+ h1,
42
+ h2,
43
+ h3,
44
+ h4,
45
+ h5,
46
+ h6,
47
+ ul li,
48
+ ol li {
49
+ margin: 0;
50
+ padding: 0;
51
+ color: ${theme.colors.dark};
52
+ }
53
+
54
+ a {
55
+ color: ${theme.isDark ? theme.colors.dark : theme.colors.primary};
56
+ }
57
+
58
+ ol,
59
+ ul {
60
+ list-style: none;
61
+ margin: 0;
62
+ padding: 0;
63
+ }
64
+
65
+ figure {
66
+ margin: 0;
67
+ }
68
+
69
+ fieldset {
70
+ appearance: none;
71
+ border: none;
72
+ }
73
+
74
+ button,
75
+ input,
76
+ a,
77
+ img,
78
+ svg,
79
+ svg * {
80
+ transition: all 0.3s ease;
81
+ }
82
+
83
+ strong,
84
+ b {
85
+ font-weight: 700;
86
+ }
87
+
88
+ hr {
89
+ margin: 20px 0;
90
+ border: none;
91
+ border-bottom: 1px solid ${theme.colors.grayLight};
92
+ }
93
+ `;
94
+
95
+ export { GlobalStyles };