Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

add new icons and ui elements

Marc Seitz2d475fd75b0b
diff --git a/components/shared/icons/alert-circle.tsx b/components/shared/icons/alert-circle.tsx
new file mode 100644
index 00000000..af1b991e
--- /dev/null
+++ b/components/shared/icons/alert-circle.tsx
@@ -0,0 +1,26 @@
+export default function AlertCircle({
+ className,
+ fill,
+}: {
+ className?: string;
+ fill?: string;
+}) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill={fill || "none"}
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={className}
+ shapeRendering="geometricPrecision"
+ >
+ <circle cx="12" cy="12" r="10" />
+ <line x1="12" x2="12" y1="8" y2="12" />
+ <line x1="12" x2="12.01" y1="16" y2="16" />
+ </svg>
+ );
+}
diff --git a/components/shared/icons/check-cirlce-2.tsx b/components/shared/icons/check-cirlce-2.tsx
new file mode 100644
index 00000000..84ad1757
--- /dev/null
+++ b/components/shared/icons/check-cirlce-2.tsx
@@ -0,0 +1,19 @@
+export default function CheckCircle2({ className, fill }: { className?: string, fill?: string }) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill={fill || "none"}
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={className}
+ shapeRendering="geometricPrecision"
+ >
+ <path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" />
+ <path d="m9 12 2 2 4-4" />
+ </svg>
+ );
+}
\ No newline at end of file
diff --git a/components/shared/icons/external-link.tsx b/components/shared/icons/external-link.tsx
new file mode 100644
index 00000000..48ecc7bd
--- /dev/null
+++ b/components/shared/icons/external-link.tsx
@@ -0,0 +1,20 @@
+export default function CheckCircle2({className}: {className?: string;}) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={className}
+ shapeRendering="geometricPrecision"
+ >
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
+ <polyline points="15 3 21 3 21 9" />
+ <line x1="10" x2="21" y1="14" y2="3" />
+ </svg>
+ );
+}
\ No newline at end of file
diff --git a/components/shared/icons/x-circle.tsx b/components/shared/icons/x-circle.tsx
new file mode 100644
index 00000000..06cd381c
--- /dev/null
+++ b/components/shared/icons/x-circle.tsx
@@ -0,0 +1,26 @@
+export default function XCircle({
+ className,
+ fill,
+}: {
+ className?: string;
+ fill?: string;
+}) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill={fill || "none"}
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={className}
+ shapeRendering="geometricPrecision"
+ >
+ <circle cx="12" cy="12" r="10" />
+ <path d="m15 9-6 6" />
+ <path d="m9 9 6 6" />
+ </svg>
+ );
+}
\ No newline at end of file
diff --git a/components/ui/button.tsx b/components/ui/button.tsx
index c064603a..2a429523 100644
--- a/components/ui/button.tsx
+++ b/components/ui/button.tsx
@@ -3,6 +3,7 @@ import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
+import LoadingSpinner from "./loading-spinner";
const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
@@ -37,15 +38,17 @@ export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
+ loading?: boolean;
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
- ({ className, variant, size, asChild = false, ...props }, ref) => {
+ ({ className, variant, size, disabled, loading, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
+ disabled={disabled || loading}
{...props}
/>
);
diff --git a/components/ui/input.tsx b/components/ui/input.tsx
new file mode 100644
index 00000000..677d05fd
--- /dev/null
+++ b/components/ui/input.tsx
@@ -0,0 +1,25 @@
+import * as React from "react"
+
+import { cn } from "@/lib/utils"
+
+export interface InputProps
+ extends React.InputHTMLAttributes<HTMLInputElement> {}
+
+const Input = React.forwardRef<HTMLInputElement, InputProps>(
+ ({ className, type, ...props }, ref) => {
+ return (
+ <input
+ type={type}
+ className={cn(
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ ref={ref}
+ {...props}
+ />
+ )
+ }
+)
+Input.displayName = "Input"
+
+export { Input }
diff --git a/components/ui/label.tsx b/components/ui/label.tsx
new file mode 100644
index 00000000..683faa79
--- /dev/null
+++ b/components/ui/label.tsx
@@ -0,0 +1,24 @@
+import * as React from "react"
+import * as LabelPrimitive from "@radix-ui/react-label"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+
+const labelVariants = cva(
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+)
+
+const Label = React.forwardRef<
+ React.ElementRef<typeof LabelPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
+ VariantProps<typeof labelVariants>
+>(({ className, ...props }, ref) => (
+ <LabelPrimitive.Root
+ ref={ref}
+ className={cn(labelVariants(), className)}
+ {...props}
+ />
+))
+Label.displayName = LabelPrimitive.Root.displayName
+
+export { Label }
diff --git a/components/ui/loading-dots.module.css b/components/ui/loading-dots.module.css
new file mode 100644
index 00000000..3b639020
--- /dev/null
+++ b/components/ui/loading-dots.module.css
@@ -0,0 +1,40 @@
+.loading {
+ display: inline-flex;
+ align-items: center;
+}
+
+.loading .spacer {
+ margin-right: 2px;
+}
+
+.loading span {
+ animation-name: blink;
+ animation-duration: 1.4s;
+ animation-iteration-count: infinite;
+ animation-fill-mode: both;
+ width: 5px;
+ height: 5px;
+ border-radius: 50%;
+ display: inline-block;
+ margin: 0 1px;
+}
+
+.loading span:nth-of-type(2) {
+ animation-delay: 0.2s;
+}
+
+.loading span:nth-of-type(3) {
+ animation-delay: 0.4s;
+}
+
+@keyframes blink {
+ 0% {
+ opacity: 0.2;
+ }
+ 20% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0.2;
+ }
+}
diff --git a/components/ui/loading-dots.tsx b/components/ui/loading-dots.tsx
new file mode 100644
index 00000000..23ebed0e
--- /dev/null
+++ b/components/ui/loading-dots.tsx
@@ -0,0 +1,13 @@
+import styles from "./loading-dots.module.css";
+
+const LoadingDots = ({ color = "#000" }: { color?: string }) => {
+ return (
+ <span className={styles.loading}>
+ <span style={{ backgroundColor: color }} />
+ <span style={{ backgroundColor: color }} />
+ <span style={{ backgroundColor: color }} />
+ </span>
+ );
+};
+
+export default LoadingDots;
diff --git a/components/ui/loading-spinner.module.css b/components/ui/loading-spinner.module.css
new file mode 100644
index 00000000..3504c36d
--- /dev/null
+++ b/components/ui/loading-spinner.module.css
@@ -0,0 +1,72 @@
+.spinner {
+ position: relative;
+ top: 50%;
+ left: 50%;
+}
+.spinner div {
+ animation: spinner 1.2s linear infinite;
+ background: gray;
+ position: absolute;
+ border-radius: 1rem;
+ width: 30%;
+ height: 8%;
+ left: -10%;
+ top: -4%;
+}
+.spinner div:nth-child(1) {
+ animation-delay: -1.2s;
+ transform: rotate(1deg) translate(120%);
+}
+.spinner div:nth-child(2) {
+ animation-delay: -1.1s;
+ transform: rotate(30deg) translate(120%);
+}
+.spinner div:nth-child(3) {
+ animation-delay: -1s;
+ transform: rotate(60deg) translate(120%);
+}
+.spinner div:nth-child(4) {
+ animation-delay: -0.9s;
+ transform: rotate(90deg) translate(120%);
+}
+.spinner div:nth-child(5) {
+ animation-delay: -0.8s;
+ transform: rotate(120deg) translate(120%);
+}
+.spinner div:nth-child(6) {
+ animation-delay: -0.7s;
+ transform: rotate(150deg) translate(120%);
+}
+.spinner div:nth-child(7) {
+ animation-delay: -0.6s;
+ transform: rotate(180deg) translate(120%);
+}
+.spinner div:nth-child(8) {
+ animation-delay: -0.5s;
+ transform: rotate(210deg) translate(120%);
+}
+.spinner div:nth-child(9) {
+ animation-delay: -0.4s;
+ transform: rotate(240deg) translate(120%);
+}
+.spinner div:nth-child(10) {
+ animation-delay: -0.3s;
+ transform: rotate(270deg) translate(120%);
+}
+.spinner div:nth-child(11) {
+ animation-delay: -0.2s;
+ transform: rotate(300deg) translate(120%);
+}
+.spinner div:nth-child(12) {
+ animation-delay: -0.1s;
+ transform: rotate(330deg) translate(120%);
+}
+
+@keyframes spinner {
+ 0% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0;
+ }
+}
diff --git a/components/ui/loading-spinner.tsx b/components/ui/loading-spinner.tsx
new file mode 100644
index 00000000..70295424
--- /dev/null
+++ b/components/ui/loading-spinner.tsx
@@ -0,0 +1,14 @@
+import { cn } from "@/lib/utils";
+import styles from "./loading-spinner.module.css";
+
+export default function LoadingSpinner({ className }: { className?: string }) {
+ return (
+ <div className={cn("h-5 w-5", className)}>
+ <div className={cn(styles.spinner, "h-5 w-5", className)}>
+ {[...Array(12)].map((_, i) => (
+ <div key={i} />
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/package-lock.json b/package-lock.json
index b490b41a..1d101033 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,6 +19,7 @@
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
+ "@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
@@ -1735,6 +1736,29 @@
}
}
},
+ "node_modules/@radix-ui/react-label": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.0.2.tgz",
+ "integrity": "sha512-N5ehvlM7qoTLx7nWPodsPYPgMzA5WM8zZChQg8nyFJKnDO5WHdba1vv5/H6IO5LtJMfD2Q3wh1qHFGNtK0w3bQ==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/react-primitive": "1.0.3"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0",
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-menu": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.0.5.tgz",
@@ -11112,6 +11136,15 @@
"@radix-ui/react-use-layout-effect": "1.0.1"
}
},
+ "@radix-ui/react-label": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.0.2.tgz",
+ "integrity": "sha512-N5ehvlM7qoTLx7nWPodsPYPgMzA5WM8zZChQg8nyFJKnDO5WHdba1vv5/H6IO5LtJMfD2Q3wh1qHFGNtK0w3bQ==",
+ "requires": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/react-primitive": "1.0.3"
+ }
+ },
"@radix-ui/react-menu": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.0.5.tgz",
diff --git a/package.json b/package.json
index 00842587..701353bb 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
+ "@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",