-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
13 changed files
with
841 additions
and
1,218 deletions.
There are no files selected for viewing
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,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,45 +1,58 @@ | ||
import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material"; | ||
import React from "react"; | ||
import JSON5 from 'json5'; | ||
|
||
import { NeatConfig } from "@firecms/neat"; | ||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@firecms/ui"; | ||
|
||
export function CodeDialog({ | ||
open, | ||
onClose, | ||
onOpenChange, | ||
config | ||
}: { | ||
open: boolean, onClose: () => void; | ||
open: boolean, | ||
onOpenChange: (open: boolean) => void; | ||
config: NeatConfig | ||
}) { | ||
|
||
return ( | ||
<Dialog open={open} onClose={onClose}> | ||
<DialogTitle>That's a nice looking background!</DialogTitle> | ||
<Dialog open={open} onOpenChange={onOpenChange} maxWidth={"4xl"}> | ||
|
||
<DialogContent> | ||
<p> | ||
Install the package using npm or yarn, following the instructions in the <a | ||
target={"_blank"} | ||
href="https://www.npmjs.com/package/@firecms/neat">package page</a>. | ||
</p> | ||
<p> | ||
Use the following code to initialize your NeatGradient: | ||
</p> | ||
<Box component={"pre"} | ||
sx={{ | ||
p: 2, | ||
borderRadius: "8px", | ||
background: "#333", | ||
color: "#fff", | ||
}}> | ||
{JSON.stringify(config, null, 4)} | ||
</Box> | ||
|
||
<p>If you think you have a great combination, feel free to share it with us by <a | ||
href="mailto:[email protected]">email</a> or on our <a | ||
href="https://twitter.com/gatti675">Twitter account</a> and we will add it to the library. | ||
</p> | ||
<div className={"grid grid-cols-12 gap-4"}> | ||
|
||
<div className={"space-y-2 col-span-4"}> | ||
<DialogTitle variant={"h5"} className={"my-4"}>That gradient looks great!</DialogTitle> | ||
<p> | ||
Neat is a <b>free tool</b> that generates beautiful gradient animations | ||
for your website. It's easy to use and offers a wide range of customization options. | ||
</p> | ||
<p className="mt-4"> | ||
Install the package using npm or yarn, following the instructions in the <a | ||
href="https://github.com/FireCMSco/neat" target="_blank" | ||
className="text-blue-500 underline">GitHub | ||
page</a> and please leave a star ⭐. | ||
</p> | ||
|
||
<p> | ||
The following JSON configuration represents the current gradient you have selected. | ||
</p> | ||
|
||
<p>If you think you have a great combination, feel free to share it with us by <a | ||
href="mailto:[email protected]">email</a> or on our <a | ||
href="https://twitter.com/gatti675">Twitter account</a> and we will add it to the library. | ||
</p> | ||
|
||
</div> | ||
<div className={"col-span-8"}> | ||
<pre className={"text-xs font-bold rounded-8xl bg-gray-800 text-white p-2 rounded-lg"}> | ||
{JSON5.stringify(config, null, 4)} | ||
</pre> | ||
</div> | ||
</div> | ||
|
||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={onClose}>Close</Button> | ||
<Button onClick={() => onOpenChange(false)}>Close</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
|
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,111 @@ | ||
import React from 'react' | ||
|
||
import { BooleanSwitchWithLabel, Popover, Typography } from "@firecms/ui"; | ||
import { ChromePicker, ColorResult } from "react-color"; | ||
import { NeatColor } from "@firecms/neat"; | ||
|
||
export function ColorSwatch({ | ||
color, | ||
showEnabled = false, | ||
onChange, | ||
}: { | ||
color: NeatColor, | ||
onChange: (color: NeatColor) => void, | ||
showEnabled?: boolean, | ||
}) { | ||
|
||
const [displayColorPicker, setDisplayColorPicker] = React.useState(false); | ||
|
||
const handleClick = () => { | ||
setDisplayColorPicker(!displayColorPicker); | ||
}; | ||
|
||
const handleClose = () => { | ||
setDisplayColorPicker(false); | ||
}; | ||
|
||
const handleChange = (colorResult: ColorResult) => { | ||
onChange({ | ||
color: colorResult.hex.toUpperCase(), | ||
enabled: color.enabled | ||
}); | ||
}; | ||
|
||
return <Popover | ||
modal={true} | ||
trigger={<div | ||
className={"rounded-lg cursor-pointer hover:outline hover:outline-4 hover:outline-primary border border-gray-100"} | ||
style={{ | ||
width: '36px', | ||
height: '36px', | ||
background: color.enabled ? color.color : `repeating-linear-gradient( | ||
45deg, | ||
${color.color}, | ||
${color.color} 8px, | ||
#CCC 8px, | ||
#CCC 16px | ||
)` | ||
}}/>} | ||
open={displayColorPicker} | ||
onOpenChange={setDisplayColorPicker} | ||
> | ||
|
||
|
||
<div className="bg-white rounded shadow"> | ||
{showEnabled && <BooleanSwitchWithLabel value={color.enabled} | ||
className={"outline-0"} | ||
size={"small"} | ||
onValueChange={(value) => { | ||
onChange({ | ||
color: color.color, | ||
enabled: value | ||
}) | ||
}} | ||
label={<Typography | ||
variant={"button"}>Enabled</Typography>}/>} | ||
|
||
<ChromePicker disableAlpha={true} | ||
color={color.color} | ||
onChange={handleChange}/> | ||
</div> | ||
|
||
|
||
</Popover>; | ||
// return (<> | ||
// <Box> | ||
// <Box sx={{ | ||
// padding: '4px', | ||
// // background: '#fff', | ||
// borderRadius: '2px', | ||
// boxShadow: '0 0 0 1px rgba(0,0,0,.1)', | ||
// display: 'inline-block', | ||
// cursor: 'pointer', | ||
// }} onClick={handleClick}> | ||
// <div style={{ | ||
// width: '36px', | ||
// height: '36px', | ||
// borderRadius: '2px', | ||
// background: color.enabled ? color.color : `repeating-linear-gradient( | ||
// 45deg, | ||
// ${color.color}, | ||
// ${color.color} 8px, | ||
// #CCC 8px, | ||
// #CCC 16px | ||
// )` | ||
// }}/> | ||
// </Box> | ||
// | ||
// | ||
// </Box> | ||
// | ||
// <Portal> | ||
// {displayColorPicker && <Box sx={{ | ||
// position: 'absolute', | ||
// zIndex: 1300, | ||
// }}></Box>} | ||
// | ||
// </Portal> | ||
// | ||
// </> | ||
// ) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.