Skip to content

Commit c0c445c

Browse files
authored
Merge pull request #33 from wajeshubham/dev
Dev
2 parents d5e5bea + 3555472 commit c0c445c

File tree

9 files changed

+37
-13
lines changed

9 files changed

+37
-13
lines changed

components/Logo.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ const Logo: React.FC<{ size?: "xs" | "sm" | "xl" | "2xl" }> = ({
2525
const getIconClassesBySize = () => {
2626
switch (size) {
2727
case "xs":
28-
return "h-3 w-3";
28+
return "h-4 w-4 mr-1";
2929
case "sm":
30-
return "h-5 w-5";
30+
return "h-5 w-5 mr-1";
3131
case "xl":
32-
return "h-7 w-7";
32+
return "h-7 w-7 mr-2";
3333
case "2xl":
34-
return "h-9 w-9";
34+
return "h-9 w-9 mr-2";
3535
default:
36-
return "h-7 w-7";
36+
return "h-7 w-7 mr-2";
3737
}
3838
};
3939

@@ -45,7 +45,7 @@ const Logo: React.FC<{ size?: "xs" | "sm" | "xl" | "2xl" }> = ({
4545
)}
4646
>
4747
<CommandLineIcon
48-
className={clsx("inset-0 mr-2", getIconClassesBySize() || "")}
48+
className={clsx("inset-0", getIconClassesBySize() || "")}
4949
/>
5050
<span className="inline-flex items-center">
5151
Snippng

components/editor/SnippngCodeArea.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
InformationCircleIcon,
3232
} from "@heroicons/react/24/outline";
3333
import { addDoc, collection, doc, updateDoc } from "firebase/firestore";
34+
import Logo from "../Logo";
3435

3536
const SnippngCodeArea = () => {
3637
const editorRef = useRef<HTMLDivElement>(null); // useRef to persist existing ref. Might be useful when dealing with background image in future
@@ -63,6 +64,7 @@ const SnippngCodeArea = () => {
6364
uid,
6465
bgImageVisiblePatch,
6566
bgBlur,
67+
watermark,
6668
} = editorConfig;
6769

6870
const saveSnippet = async () => {
@@ -219,6 +221,15 @@ const SnippngCodeArea = () => {
219221
<SnippngWindowControls type={editorWindowControlsType} />
220222
</div>
221223
</CodeMirror>
224+
{watermark ? (
225+
<div
226+
title="Remove watermark from the settings"
227+
className="absolute bottom-1 text-white drop-shadow-[0_1px_1.2px_rgba(0,0,0,0.8)] opacity-50 right-2 text-[10px] inline-flex items-center"
228+
>
229+
<span className="mr-1">created using</span>{" "}
230+
<Logo size="xs" />
231+
</div>
232+
) : null}
222233
</div>
223234
</div>
224235
<div className="w-full mt-8 flex md:flex-row flex-col gap-4 justify-start items-center">

components/editor/SnippngControlHeader.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const SnippngControlHeader: React.FC<{
5757
snippetsName,
5858
bgBlur = 0,
5959
bgImageVisiblePatch,
60+
watermark,
6061
} = editorConfig;
6162

6263
const downloadImage = (type: SelectOptionInterface) => {
@@ -223,6 +224,17 @@ const SnippngControlHeader: React.FC<{
223224
<ArrowsUpDownIcon className="h-5 w-5 mr-2" /> Import or export
224225
config
225226
</Menu.Button>
227+
<div className="py-1 px-2">
228+
<Checkbox
229+
label="Watermark"
230+
id="watermark"
231+
data-testid="watermark"
232+
checked={watermark}
233+
onChange={() => {
234+
handleConfigChange("watermark")(!watermark);
235+
}}
236+
/>
237+
</div>
226238
<div className="py-1 px-2">
227239
<Checkbox
228240
label="Line count"

lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ const getConfig = (): SnippngEditorConfigInterface => {
546546
editorWidth: 0,
547547
bgImageVisiblePatch: null,
548548
bgBlur: 0,
549+
watermark: true,
549550
};
550551
};
551552

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "snippng",
3-
"version": "1.2.0",
3+
"version": "1.2.2",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

types/editor-ti.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const SnippngWindowControlsType = t.union(t.lit("mac-left"), t.lit("mac-r
1414
export const SnippngEditorConfigInterface = t.iface([], {
1515
"ownerUid": t.opt("string"),
1616
"uid": t.opt("string"),
17+
"watermark": t.opt("boolean"),
1718
"code": "string",
1819
"editorFontSize": "number",
1920
"editorWidth": "number",

types/editor.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { SelectOptionInterface } from "./tsx";
1+
export interface SelectOptionInterface {
2+
id: string;
3+
label: string;
4+
}
25

36
export type SnippngWindowControlsType =
47
| "mac-left"
@@ -9,6 +12,7 @@ export type SnippngWindowControlsType =
912
export interface SnippngEditorConfigInterface {
1013
ownerUid?: string;
1114
uid?: string;
15+
watermark?: boolean;
1216
code: string;
1317
editorFontSize: number;
1418
editorWidth: number;

types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import exportedTypeSuite from "./editor-ti";
22

3-
export * from "./tsx";
43
export * from "./editor";
54
export * from "./toast";
65

types/tsx.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)