Skip to content

Commit

Permalink
✨ export color config
Browse files Browse the repository at this point in the history
✨ export color config
  • Loading branch information
ElianCodes committed Mar 19, 2023
2 parents bd771d0 + c49f81f commit 859b7b3
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 26 deletions.
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ declare module '@eliancodes/brutal-ui' {

export function Card(props: DefaultColorProps): any;
export function Pill(props: DefaultColorProps): any;

type BrutalConfiguration = {
colors: string[]
};

export function Config(): BrutalConfiguration;
}
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as Button } from './src/components/Button.astro';
export { default as Card } from './src/components/Card.astro';
export { default as Pill } from './src/components/Pill.astro';
export { default as Config } from './src/config';
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eliancodes/brutal-ui",
"version": "0.1.1",
"version": "0.2.0",
"description": "The brutalist UI components package, built for extendability and compatibility",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (Astro.props.target === undefined) {
if (Astro.props.color === undefined) {
Astro.props.color =
colors.colors[Math.floor(Math.random() * colors.colors.length)];
colors[Math.floor(Math.random() * colors.length)];
}
const { href, target, color } = Astro.props;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import colors from '../config/colors.json';
if (Astro.props.color === undefined) {
Astro.props.color =
colors.colors[Math.floor(Math.random() * colors.colors.length)];
colors[Math.floor(Math.random() * colors.length)];
}
const { color } = Astro.props;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pill.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import colors from '../config/colors.json';
if (Astro.props.color === undefined) {
Astro.props.color =
colors.colors[Math.floor(Math.random() * colors.colors.length)];
colors[Math.floor(Math.random() * colors.length)];
}
const { color } = Astro.props;
Expand Down
38 changes: 18 additions & 20 deletions src/config/colors.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
{
"colors": [
"#c084fc",
"#f472b6",
"#fb7185",
"#e879f9",
"#a78bfa",
"#818cf8",
"#60a5fa",
"#38bdf8",
"#22d3ee",
"#2dd4bf",
"#34d399",
"#4ade80",
"#a3e635",
"#facc15",
"#fb923c",
"#f87171"
]
}
[
"#c084fc",
"#f472b6",
"#fb7185",
"#e879f9",
"#a78bfa",
"#818cf8",
"#60a5fa",
"#38bdf8",
"#22d3ee",
"#2dd4bf",
"#34d399",
"#4ade80",
"#a3e635",
"#facc15",
"#fb923c",
"#f87171"
]
7 changes: 7 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import colors from './colors.json';

const Config = {
colors,
}

export default Config;

0 comments on commit 859b7b3

Please sign in to comment.