-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
2,526 additions
and
339 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
import { Autocomplete } from "@mantine/core"; | ||
|
||
export default function ComboBox() { | ||
const [value, setValue] = useState<string>(""); | ||
return ( | ||
<> | ||
<Autocomplete | ||
value={value} | ||
onChange={setValue} | ||
label="Your favorite library" | ||
placeholder="Pick value or enter anything" | ||
data={["React", "Angular", "Vue", "Svelte"]} | ||
/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
import { Button } from "@mantine/core"; | ||
|
||
export const Counter = () => { | ||
const [count, setCount] = useState(0); | ||
|
||
const handleIncrement = () => setCount((c) => c + 1); | ||
|
||
return ( | ||
<section className="border-blue-400 -mx-4 mt-4 rounded border border-dashed p-4"> | ||
<div>Count: {count}</div> | ||
<Button onClick={handleIncrement}>Increment</Button> | ||
</section> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"use client"; | ||
|
||
import { ModalsProvider } from "@mantine/modals"; | ||
|
||
export default function ModalsProviderDemo({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return <ModalsProvider>{children}</ModalsProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use client"; | ||
|
||
import { Carousel } from "@mantine/carousel"; | ||
|
||
const slideStyles = (backgroundColor: string) => ({ | ||
backgroundColor, | ||
padding: 16, | ||
color: "white", | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}); | ||
|
||
export default function MyCarousel() { | ||
return ( | ||
<Carousel withIndicators height={200}> | ||
<Carousel.Slide style={slideStyles("red")}> | ||
<h1>1</h1> | ||
</Carousel.Slide> | ||
<Carousel.Slide style={slideStyles("blue")}> | ||
<h1>2</h1> | ||
</Carousel.Slide> | ||
<Carousel.Slide style={slideStyles("green")}> | ||
<h1>3</h1> | ||
</Carousel.Slide> | ||
{/* ...other slides */} | ||
</Carousel> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use client"; | ||
|
||
import { CodeHighlight } from "@mantine/code-highlight"; | ||
|
||
const exampleCode = ` | ||
// VisuallyHidden component source code | ||
import { | ||
Box, | ||
BoxProps, | ||
StylesApiProps, | ||
factory, | ||
ElementProps, | ||
useProps, | ||
useStyles, | ||
Factory, | ||
} from '../../core'; | ||
import classes from './VisuallyHidden.module.css'; | ||
export type VisuallyHiddenStylesNames = 'root'; | ||
export interface VisuallyHiddenProps | ||
extends BoxProps, | ||
StylesApiProps<VisuallyHiddenFactory>, | ||
ElementProps<'div'> {} | ||
export type VisuallyHiddenFactory = Factory<{ | ||
props: VisuallyHiddenProps; | ||
ref: HTMLDivElement; | ||
stylesNames: VisuallyHiddenStylesNames; | ||
}>; | ||
const defaultProps: Partial<VisuallyHiddenProps> = {}; | ||
export const VisuallyHidden = factory<VisuallyHiddenFactory>((_props, ref) => { | ||
const props = useProps('VisuallyHidden', defaultProps, _props); | ||
const { classNames, className, style, styles, unstyled, vars, ...others } = props; | ||
const getStyles = useStyles<VisuallyHiddenFactory>({ | ||
name: 'VisuallyHidden', | ||
classes, | ||
props, | ||
className, | ||
style, | ||
classNames, | ||
styles, | ||
unstyled, | ||
}); | ||
return <Box component="span" ref={ref} {...getStyles('root')} {...others} />; | ||
}); | ||
VisuallyHidden.classes = classes; | ||
VisuallyHidden.displayName = '@mantine/core/VisuallyHidden'; | ||
`; | ||
export default function MyCodeHighlight() { | ||
return <CodeHighlight code={exampleCode} language="tsx" />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
//import 'dayjs/locale/de'; | ||
import { DateInput } from "@mantine/dates"; | ||
|
||
export default function MyDate() { | ||
const [value, setValue] = useState<Date | null>(null); | ||
return ( | ||
<DateInput | ||
//locale="de" | ||
value={value} | ||
onChange={setValue} | ||
label="Date input" | ||
placeholder="Date input" | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
"use client"; | ||
|
||
import { Group, rem, Text } from "@mantine/core"; | ||
import { Dropzone, DropzoneProps, IMAGE_MIME_TYPE } from "@mantine/dropzone"; | ||
import { IconPhoto, IconUpload, IconX } from "@tabler/icons-react"; | ||
|
||
export default function MyDropzone(props: Partial<DropzoneProps>) { | ||
return ( | ||
<Dropzone | ||
onDrop={(files) => console.log("accepted files", files)} | ||
onReject={(files) => console.log("rejected files", files)} | ||
maxSize={5 * 1024 ** 2} | ||
accept={IMAGE_MIME_TYPE} | ||
{...props} | ||
> | ||
<Group | ||
justify="center" | ||
gap="xl" | ||
mih={220} | ||
style={{ pointerEvents: "none" }} | ||
> | ||
<Dropzone.Accept> | ||
<IconUpload | ||
style={{ | ||
width: rem(52), | ||
height: rem(52), | ||
color: "var(--mantine-color-blue-6)", | ||
}} | ||
stroke={1.5} | ||
/> | ||
</Dropzone.Accept> | ||
<Dropzone.Reject> | ||
<IconX | ||
style={{ | ||
width: rem(52), | ||
height: rem(52), | ||
color: "var(--mantine-color-red-6)", | ||
}} | ||
stroke={1.5} | ||
/> | ||
</Dropzone.Reject> | ||
<Dropzone.Idle> | ||
<IconPhoto | ||
style={{ | ||
width: rem(52), | ||
height: rem(52), | ||
color: "var(--mantine-color-dimmed)", | ||
}} | ||
stroke={1.5} | ||
/> | ||
</Dropzone.Idle> | ||
|
||
<div> | ||
<Text size="xl" inline> | ||
Drag images here or click to select files | ||
</Text> | ||
<Text size="sm" c="dimmed" inline mt={7}> | ||
Attach as many files as you like, each file should not exceed 5mb | ||
</Text> | ||
</div> | ||
</Group> | ||
</Dropzone> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client"; | ||
|
||
import { Button, Text } from "@mantine/core"; | ||
import { modals } from "@mantine/modals"; | ||
|
||
export default function MyModal() { | ||
const openModal = () => | ||
modals.openConfirmModal({ | ||
title: "Please confirm your action", | ||
children: ( | ||
<Text size="sm"> | ||
This action is so important that you are required to confirm it with a | ||
modal. Please click one of these buttons to proceed. | ||
</Text> | ||
), | ||
labels: { confirm: "Confirm", cancel: "Cancel" }, | ||
onCancel: () => console.log("Cancel"), | ||
onConfirm: () => console.log("Confirmed"), | ||
}); | ||
|
||
return <Button onClick={openModal}>Open confirm modal</Button>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"use client"; | ||
import { Button, Group } from "@mantine/core"; | ||
import { NavigationProgress, nprogress } from "@mantine/nprogress"; | ||
|
||
export default function MyNavigationProgress() { | ||
return ( | ||
<> | ||
<NavigationProgress /> | ||
<Group justify="center"> | ||
<Button onClick={() => nprogress.start()}>Start</Button> | ||
<Button onClick={() => nprogress.stop()}>Stop</Button> | ||
<Button onClick={() => nprogress.increment()}>Increment</Button> | ||
<Button onClick={() => nprogress.decrement()}>Decrement</Button> | ||
<Button onClick={() => nprogress.set(50)}>Set 50%</Button> | ||
<Button onClick={() => nprogress.reset()}>Reset</Button> | ||
<Button onClick={() => nprogress.complete()}>Complete</Button> | ||
</Group> | ||
</> | ||
); | ||
} |
Oops, something went wrong.