Skip to content

Commit

Permalink
Migrated from MUI to FireCMS UI
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Oct 14, 2024
1 parent 06d39ae commit dce1301
Show file tree
Hide file tree
Showing 13 changed files with 841 additions and 1,218 deletions.
22 changes: 22 additions & 0 deletions editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@

<meta name="robots" content="index">
<link rel="canonical" href="https://neat.firecms.co" />

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Londrina+Shadow&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lemonada:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Rubik&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Alegreya:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Concert+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:wght@400;700&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
Expand Down
11 changes: 6 additions & 5 deletions editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@firecms/neat": "0.1.0",
"@firecms/ui": "^3.0.0-canary.136",
"@fontsource/roboto": "^4.5.8",
"@fontsource/sofia-sans": "^4.5.0",
"@mui/icons-material": "^5.10.6",
"@mui/material": "^5.10.7",
"@mui/styles": "^5.10.8",
"@tailwindcss/typography": "^0.5.15",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.11.62",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"autoprefixer": "^10.4.20",
"firebase": "^9.12.1",
"json5": "^2.2.3",
"markdown-it": "^14.1.0",
"mui-color-input": "^1.0.2",
"react": "^18.2.0",
"react-color": "^3.0.0-beta.3",
"react-dom": "^18.2.0",
"tailwindcss": "^3.4.13",
"three": "^0.169.0",
"typescript": "^4.8.4",
"web-vitals": "^2.1.4"
Expand Down
6 changes: 6 additions & 0 deletions editor/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
69 changes: 41 additions & 28 deletions editor/src/components/CodeDialog.tsx
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:hello@firecms.co">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:hello@firecms.co">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>
);
Expand Down
111 changes: 111 additions & 0 deletions editor/src/components/ColorSwatch.tsx
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>
//
// </>
// )
}
119 changes: 0 additions & 119 deletions editor/src/components/ColowSwatch.tsx

This file was deleted.

Loading

0 comments on commit dce1301

Please sign in to comment.