Skip to content

Commit 859b7b3

Browse files
authored
✨ export color config
✨ export color config
2 parents bd771d0 + c49f81f commit 859b7b3

File tree

9 files changed

+38
-26
lines changed

9 files changed

+38
-26
lines changed

index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ declare module '@eliancodes/brutal-ui' {
1313

1414
export function Card(props: DefaultColorProps): any;
1515
export function Pill(props: DefaultColorProps): any;
16+
17+
type BrutalConfiguration = {
18+
colors: string[]
19+
};
20+
21+
export function Config(): BrutalConfiguration;
1622
}

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { default as Button } from './src/components/Button.astro';
22
export { default as Card } from './src/components/Card.astro';
33
export { default as Pill } from './src/components/Pill.astro';
4+
export { default as Config } from './src/config';

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eliancodes/brutal-ui",
3-
"version": "0.1.1",
3+
"version": "0.2.0",
44
"description": "The brutalist UI components package, built for extendability and compatibility",
55
"repository": {
66
"type": "git",

src/components/Button.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if (Astro.props.target === undefined) {
1313
1414
if (Astro.props.color === undefined) {
1515
Astro.props.color =
16-
colors.colors[Math.floor(Math.random() * colors.colors.length)];
16+
colors[Math.floor(Math.random() * colors.length)];
1717
}
1818
1919
const { href, target, color } = Astro.props;

src/components/Card.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import colors from '../config/colors.json';
66
77
if (Astro.props.color === undefined) {
88
Astro.props.color =
9-
colors.colors[Math.floor(Math.random() * colors.colors.length)];
9+
colors[Math.floor(Math.random() * colors.length)];
1010
}
1111
1212
const { color } = Astro.props;

src/components/Pill.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import colors from '../config/colors.json';
66
77
if (Astro.props.color === undefined) {
88
Astro.props.color =
9-
colors.colors[Math.floor(Math.random() * colors.colors.length)];
9+
colors[Math.floor(Math.random() * colors.length)];
1010
}
1111
1212
const { color } = Astro.props;

src/config/colors.json

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
{
2-
"colors": [
3-
"#c084fc",
4-
"#f472b6",
5-
"#fb7185",
6-
"#e879f9",
7-
"#a78bfa",
8-
"#818cf8",
9-
"#60a5fa",
10-
"#38bdf8",
11-
"#22d3ee",
12-
"#2dd4bf",
13-
"#34d399",
14-
"#4ade80",
15-
"#a3e635",
16-
"#facc15",
17-
"#fb923c",
18-
"#f87171"
19-
]
20-
}
1+
[
2+
"#c084fc",
3+
"#f472b6",
4+
"#fb7185",
5+
"#e879f9",
6+
"#a78bfa",
7+
"#818cf8",
8+
"#60a5fa",
9+
"#38bdf8",
10+
"#22d3ee",
11+
"#2dd4bf",
12+
"#34d399",
13+
"#4ade80",
14+
"#a3e635",
15+
"#facc15",
16+
"#fb923c",
17+
"#f87171"
18+
]

src/config/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import colors from './colors.json';
2+
3+
const Config = {
4+
colors,
5+
}
6+
7+
export default Config;

0 commit comments

Comments
 (0)