Skip to content

Commit e2867b8

Browse files
author
Roshan Jossy
committed
update dark mode theme for editorjs tools
1 parent 8e5267d commit e2867b8

File tree

7 files changed

+36
-9
lines changed

7 files changed

+36
-9
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"sourceType": "module"
1919
},
2020
"rules": {
21-
"@next/next/no-html-link-for-pages": "off"
21+
"@next/next/no-html-link-for-pages": "off",
22+
"@next/next/no-img-element": "off"
2223
},
2324
"plugins": ["@typescript-eslint"]
2425
}

src/components/Card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export default function Card({
99
}) {
1010
return (
1111
<div
12-
className={`py-4 px-8 bg-white dark:bg-dark-700 rounded-lg ${classes}`}
12+
className={`py-4 px-8 bg-white dark:bg-dark-700 rounded-lg ${
13+
classes || ''
14+
}`}
1315
>
1416
{children}
1517
</div>

src/components/UserDetails/Badges/Badge.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { graphql, useFragment } from 'react-relay'
2-
import BadgeIcon from './BadgeIcon'
2+
import { Badge_node$key } from '../../../queries/__generated__/Badge_node.graphql'
3+
import BadgeIcon, { LanguageName } from './BadgeIcon'
34
import Hexagon from './Hexagon'
45

5-
const Badge = ({ badge }: any) => {
6+
const Badge = ({ badge }: { badge: Badge_node$key }) => {
67
const data = useFragment(
78
graphql`
89
fragment Badge_node on Badge {
@@ -17,7 +18,7 @@ const Badge = ({ badge }: any) => {
1718
return (
1819
<div className="flex items-center ">
1920
<Hexagon size={60} color="red">
20-
<BadgeIcon displayName={data.displayName} />
21+
<BadgeIcon displayName={data.displayName as LanguageName} />
2122
</Hexagon>
2223
<div className=" ml-8 dark:text-gray-300">
2324
<span className="font-bold block">Level: {data.currentLevel}</span>

src/components/UserDetails/Badges/BadgeIcon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ const iconMap = {
2525
PHP: <SiPhp />,
2626
}
2727

28+
export type LanguageName = keyof typeof iconMap
29+
2830
type BadgeIconProps = {
29-
displayName: keyof typeof iconMap
31+
displayName: LanguageName
3032
}
3133

3234
export default function BadgeIcon({ displayName }: BadgeIconProps) {

src/components/story/StoryEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function Editor({ title, body }: EditorProps) {
9898
})
9999
}
100100
return (
101-
<Card classes="prose max-w-none">
101+
<Card classes="prose max-w-none dark:prose-invert">
102102
<div>
103103
<div id={EDITTOR_HOLDER_ID}> </div>
104104
</div>

src/styles/globals.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,24 @@
33
@tailwind utilities;
44

55

6+
.dark .ce-inline-tool,
7+
.dark .ce-toolbar__plus,
8+
.dark .ce-toolbar__settings-btn {
9+
@apply text-gray-400
10+
}
11+
12+
.dark .ce-inline-toolbar,
13+
.dark .ce-conversion-toolbar,
14+
.dark .ce-toolbox,
15+
.dark .ce-popover,
16+
.dark .ce-settings {
17+
@apply bg-dark-600 border-dark-500
18+
}
19+
20+
.dark .ce-popover__item-icon {
21+
@apply bg-dark-500
22+
}
23+
24+
.dark .ce-block--selected {
25+
@apply bg-dark-500 text-gray-800
26+
}

tailwind.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module.exports = {
1212
200: '#eaddd7',
1313
300: '#e0cec7',
1414
400: '#d2bab0',
15-
500: '#bfa094',
16-
600: '#40444b',
15+
500: '#40444b',
16+
600: '#42464d',
1717
700: '#36393f',
1818
800: '#2f3136',
1919
900: '#202225',

0 commit comments

Comments
 (0)