Skip to content

Commit e3b5ad8

Browse files
committed
✨ add first prototype
1 parent 1a3ba2b commit e3b5ad8

File tree

7 files changed

+100
-28
lines changed

7 files changed

+100
-28
lines changed

index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
declare module '@eliancodes/brutal-ui' {
2+
type ButtonProps = {
3+
href: string;
4+
target: '_blank' | '_self';
5+
color: string;
6+
string: string;
7+
}
8+
9+
export function Button(props: ButtonProps): any;
10+
}

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Button } from './src/components/Button.astro';

package-lock.json

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

package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@
22
"name": "@eliancodes/brutal-ui",
33
"version": "0.1.0",
44
"description": "The brutalist UI components package, built for extendability and compatibility",
5-
"main": "index.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
95
"repository": {
106
"type": "git",
117
"url": "git+https://github.com/ElianCodes/brutal-ui.git"
128
},
9+
"type": "module",
10+
"main": "index.ts",
11+
"module": "index.ts",
12+
"exports": {
13+
".": {
14+
"import": "./index.ts",
15+
"require": null
16+
}
17+
},
18+
"types": "index.d.ts",
19+
"files": [
20+
"index.ts",
21+
"index.d.ts",
22+
"src"
23+
],
1324
"keywords": [
1425
"astro",
1526
"brutal",

src/components/Button.astro

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
interface Props {
3+
href: string;
4+
target: '_blank' | '_self';
5+
color: string;
6+
string: string;
7+
}
8+
9+
const colors = await Astro.glob('../config/colors.json')
10+
11+
const { href, target, color } = Astro.props;
12+
---
13+
<style>
14+
a.btn {
15+
filter: drop-shadow(5px 5px 0 rgb(0 0 0 / 1));
16+
}
17+
a.btn:hover {
18+
filter: drop-shadow(3px 3px 0 rgb(0 0 0 / 1));
19+
}
20+
</style>
21+
22+
<a
23+
href={href}
24+
target={target}
25+
class:list={[
26+
color
27+
? `hover:bg-${color}`
28+
: `hover:bg-${colors[Math.floor(Math.random() * colors.length)]}`,
29+
'btn bg-white sanchez inline-block py-2 px-4 border-2 border-black transition-all ease-in-out duration-150',
30+
]}
31+
>
32+
test
33+
<slot />
34+
</a>

src/config/colors.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"colors": [
3+
{ "green": "green" }
4+
]
5+
}

tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "astro/tsconfigs/strictest",
3+
"include": ["src"],
4+
"compilerOptions": {
5+
"allowJs": true,
6+
"module": "ES2022",
7+
"outDir": "./dist",
8+
"target": "ES2021",
9+
"strictNullChecks": true
10+
}
11+
}

0 commit comments

Comments
 (0)