-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from MysticalMike60t/dev
A bunch of changes, including variables users can change
- Loading branch information
Showing
15 changed files
with
227 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
const Default = ({ | ||
className = "caden-ui-buttons-default", | ||
children, | ||
...props | ||
}) => { | ||
return ( | ||
<button className={className} {...props}> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
Default.propTypes = { | ||
className: PropTypes.string, | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Default; |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import Default from './Default'; | ||
import Submit from './Submit'; | ||
|
||
const Buttons = { | ||
Submit, | ||
Default | ||
}; | ||
|
||
export default Buttons; |
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,30 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import classNames from "classnames"; | ||
|
||
const Default = ({ | ||
className = "caden-ui-links-default", | ||
href = "#", | ||
filled = false, | ||
children, | ||
...props | ||
}) => { | ||
const combinedClassName = classNames(className, { | ||
"caden-ui-links-default-filled": filled, | ||
}); | ||
|
||
return ( | ||
<a className={combinedClassName} href={href} {...props}> | ||
{children} | ||
</a> | ||
); | ||
}; | ||
|
||
Default.propTypes = { | ||
className: PropTypes.string, | ||
href: PropTypes.string, | ||
filled: PropTypes.bool, | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Default; |
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,7 @@ | ||
import Default from "./Default"; | ||
|
||
const Links = { | ||
Default, | ||
}; | ||
|
||
export default Links; |
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,9 +1,11 @@ | ||
import Layouts from './Layouts'; | ||
import Buttons from './Buttons'; | ||
import Links from './Links'; | ||
|
||
const UI = { | ||
Layouts, | ||
Buttons, | ||
Links, | ||
}; | ||
|
||
export default UI; |
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,33 @@ | ||
import setDefaults from "./local_functions/setDefaults"; | ||
import { updateCSSVariables } from "./local_functions/updateCSSVariables"; | ||
|
||
const defaultConfig = { | ||
style: { | ||
color: { | ||
primary: { | ||
hex: "#ae7eec", | ||
rgb: "rgb(174, 126, 236)", | ||
rgba: "rgba(174, 126, 236, 1)", | ||
hsl: "hsl(270, 60%, 70%)", | ||
hover: { | ||
hex: "#8b5ebf", | ||
rgb: "rgb(139, 94, 191)", | ||
rgba: "rgba(139, 94, 191, 1)", | ||
hsl: "hsl(270, 40%, 60%)", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const config = {}; | ||
|
||
setDefaults(config, defaultConfig); | ||
updateCSSVariables(config); | ||
|
||
export const setConfig = (newConfig) => { | ||
setDefaults(config, newConfig); | ||
updateCSSVariables(config); | ||
}; | ||
|
||
export default config; |
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,11 +1,13 @@ | ||
import UI from "./UI"; | ||
import Functions from "./Functions"; | ||
import { setConfig } from "./config"; | ||
import "./styles/css/index.css"; | ||
|
||
const Caden = { | ||
UI, | ||
Functions, | ||
setConfig | ||
}; | ||
|
||
export { UI, Functions }; | ||
export { UI, Functions, setConfig }; | ||
export default Caden; |
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,12 @@ | ||
const setDefaults = (target, defaults) => { | ||
for (const key in defaults) { | ||
if (typeof defaults[key] === "object" && !Array.isArray(defaults[key])) { | ||
target[key] = target[key] || {}; | ||
setDefaults(target[key], defaults[key]); | ||
} else { | ||
target[key] = target[key] !== undefined ? target[key] : defaults[key]; | ||
} | ||
} | ||
}; | ||
|
||
export default setDefaults; |
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,16 @@ | ||
export const updateCSSVariables = (config) => { | ||
const root = document.documentElement; | ||
if (config.style && config.style.color && config.style.color.primary) { | ||
const primary = config.style.color.primary; | ||
root.style.setProperty("--primary-color", primary.hex); | ||
root.style.setProperty("--primary-color-rgb", primary.rgb); | ||
root.style.setProperty("--primary-color-rgba", primary.rgba); | ||
root.style.setProperty("--primary-color-hsl", primary.hsl); | ||
if (primary.hover) { | ||
root.style.setProperty("--primary-color-hover", primary.hover.hex); | ||
root.style.setProperty("--primary-color-hover-rgb", primary.hover.rgb); | ||
root.style.setProperty("--primary-color-hover-rgba", primary.hover.rgba); | ||
root.style.setProperty("--primary-color-hover-hsl", primary.hover.hsl); | ||
} | ||
} | ||
}; |
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,11 @@ | ||
/* src/styles/css/variables.css */ | ||
:root { | ||
--primary-color: #ae7eec; | ||
--primary-color-rgb: 174, 126, 236; | ||
--primary-color-rgba: rgba(174, 126, 236, 1); | ||
--primary-color-hsl: hsl(270, 60%, 70%); | ||
--primary-color-hover: #8b5ebf; | ||
--primary-color-hover-rgb: 139, 94, 191; | ||
--primary-color-hover-rgba: rgba(139, 94, 191, 1); | ||
--primary-color-hover-hsl: hsl(270, 40%, 60%); | ||
} |
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