Skip to content

Commit 32229f3

Browse files
author
Zaydek Michels-Gualtieri
committed
Deprecated Material Design colors, added TransitionV2 but did not integrate yet
1 parent 83c3549 commit 32229f3

File tree

12 files changed

+185
-421
lines changed

12 files changed

+185
-421
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// https://github.com/codex-src/dot-eslintrc.js
1+
// https://github.com/codex-src/dot-eslintrc.js (2483dfa)
22
module.exports = {
33
env: {
44
browser: true,
@@ -84,7 +84,7 @@ module.exports = {
8484
"prefer-numeric-literals": 1, // disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
8585
"prefer-object-spread": 1, // disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
8686
"prefer-template": 0, // require template literals instead of string concatenation
87-
"quote-props": [1, "as-needed"], // require quotes around object literal property names
87+
"quote-props": 0, // require quotes around object literal property names
8888
"quotes": 1, // enforce the consistent use of either backticks, double, or single quotes
8989
"rest-spread-spacing": 1, // enforce spacing between rest and spread operators and their expressions
9090
"semi": [1, "never"], // require or disallow semicolons instead of ASI

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
# Production
1010
/build
11-
*.generated.css
11+
tailwind.generated.css

src/Editor/Elements/Elements.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const TodoItem = React.memo(({ id, syntax, checked, children, dispatch })
170170
ref={ref}
171171
className={dedupeSpaces(`
172172
form-checkbox
173-
text-md-blue-a200
173+
text-blue-500
174174
border-none
175175
rounded-md
176176
shadow-hero
@@ -181,6 +181,8 @@ export const TodoItem = React.memo(({ id, syntax, checked, children, dispatch })
181181
duration-150
182182
cursor-pointer
183183
`)}
184+
// FIXME: Remove style={{ ... }}
185+
style={{ color: "var(--blue-500)" }}
184186
type="checkbox"
185187
checked={checked}
186188
onChange={() => {

src/Editor/Elements/InlineElements.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ export const StrongEmphasis = ({ syntax, children }) => (
4343
)
4444

4545
export const Code = ({ syntax, children }) => (
46-
<code className="px-1 py-px text-md-blue-a400 border rounded" {...attrs.disableAutoCorrect}>
46+
<code className="px-1 py-px text-blue-500 border rounded" {...attrs.disableAutoCorrect}>
4747
<Markdown syntax={syntax}>
4848
{children}
4949
</Markdown>
5050
</code>
5151
)
5252

5353
export const Strikethrough = ({ syntax, children }) => (
54-
<strike className="line-through text-gray-500" style={{ "--md-blue-a400": "currentColor" }}>
54+
<strike className="line-through text-gray-500" style={{ "--blue-500": "currentColor" }}>
5555
<Markdown syntax={syntax}>
5656
{children}
5757
</Markdown>
5858
</strike>
5959
)
6060

6161
export const Anchor = ({ syntax, href, children }) => (
62-
<a className="underline text-md-blue-a400" href={href} {...attrs.a}>
62+
<a className="underline text-blue-500" href={href} {...attrs.a}>
6363
<Markdown syntax={!children || syntax} {...attrs.disableAutoCorrect}>
6464
{children || syntax}
6565
</Markdown>

src/Editor/stylesheets/core.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
}
1313

1414
.codex-editor [aria-label][role="img"] {
15-
vertical-align: -10%;
16-
font-size: 120%;
15+
vertical-align: -18.75%;
16+
font-size: 137.5%;
1717
line-height: 1;
1818
}
1919

@@ -27,7 +27,7 @@
2727
margin-left: -1.5em;
2828
position: absolute;
2929
content: "• ";
30-
color: var(--md-blue-a400);
30+
color: var(--blue-500);
3131
}
3232

3333
.codex-editor [data-codex-ordered="true"]:first-of-type {
@@ -39,7 +39,7 @@
3939
content: counter(count) ". ";
4040
counter-increment: count;
4141
font-feature-settings: "tnum";
42-
color: var(--md-blue-a400);
42+
color: var(--blue-500);
4343
}
4444

4545
.codex-editor [data-codex-checked] input[type="checkbox"] {

src/Editor/stylesheets/theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
}
1717

1818
.codex-editor .markdown {
19-
color: var(--md-blue-a400);
19+
color: var(--blue-500);
2020
}

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from "react"
33
import ReactDOM from "react-dom"
44

55
import "debug.css"
6-
import "stylesheets/material-design/color-vars.css"
76
import "stylesheets/prism/custom.css"
87
import "stylesheets/tailwind/color-vars.css"
98
import "stylesheets/tailwind/em-context.css"

src/lib/TransitionV2.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from "react"
2+
3+
const TransitionV2 = ({
4+
on,
5+
transition,
6+
from,
7+
to,
8+
children,
9+
}) => {
10+
const ref = React.useRef()
11+
12+
const transitionClasses = (transition || "").split(/\s+/)
13+
const fromClasses = from.split(/\s+/)
14+
const toClasses = to.split(/\s+/)
15+
16+
const mounted = React.useRef()
17+
React.useLayoutEffect(() => {
18+
const actualRef = children.ref || ref
19+
if (!mounted.current && transitionClasses.length && transitionClasses[0]) { // Guards "".split(/\s+/) -> [""]
20+
actualRef.current.classList.add(...transitionClasses)
21+
}
22+
if (!on) {
23+
actualRef.current.classList.remove(...toClasses)
24+
actualRef.current.classList.add(...fromClasses)
25+
} else {
26+
actualRef.current.classList.remove(...fromClasses)
27+
actualRef.current.classList.add(...toClasses)
28+
}
29+
}, [
30+
on,
31+
children.ref,
32+
ref,
33+
transitionClasses,
34+
fromClasses,
35+
toClasses,
36+
])
37+
38+
return !children.ref ? React.cloneElement(children, { ref }) : children
39+
}
40+
41+
export default TransitionV2

0 commit comments

Comments
 (0)