Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasphil committed Aug 20, 2024
1 parent b846162 commit 815dcc1
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 118 deletions.
3 changes: 1 addition & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { setup } from "@storybook/vue3";
import PrimeVue from "primevue/config";
import preset from "../src/components/preset";
import "../src/global.css";
import preset from "../src/preset";

setup((app) => {
app.use(PrimeVue, {
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build": "vue-tsc -b && vite build",
"build:storybook": "storybook build",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write --ignore-unknown ."
Expand Down
11 changes: 0 additions & 11 deletions src/components/preset.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/global.css

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Button from "primevue/button";
import IconCheck from "~icons/ic/baseline-check";

const meta: Meta<typeof Button> = {
title: "Buttons",
component: Button,
tags: ["autodocs"],
argTypes: {
Expand Down
36 changes: 6 additions & 30 deletions src/components/button/button.ts → src/preset/button/button.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
interface ButtonProps {
label?: string;
size?: "small" | "large";
severity?: "primary" | "secondary" | "ghost";
iconPos?: "left" | "right";
disabled?: boolean;
iconSize?: number;
}
import { ButtonPassThroughOptions } from "primevue/button";

interface ButtonContext {
slots: {
icon?: boolean;
};
disabled: boolean;
}

interface ButtonInstance {
hasIcon: boolean;
}

export default {
root: ({
props,
context,
instance,
}: {
props: ButtonProps;
context: ButtonContext;
instance: ButtonInstance;
}) => {
const button: ButtonPassThroughOptions = {
root: ({ props, context, instance }) => {
// Define variables for different parts of the styling logic
let iconStyling;
let sizeStyling;
Expand Down Expand Up @@ -139,10 +113,12 @@ export default {
],
};
},
label: ({ props }: { props: ButtonProps }) => ({
label: ({ props }) => ({
class: [
{ underline: props.severity === "ghost" },
{ "sr-only": !props.label },
],
}),
};

export default button;
15 changes: 15 additions & 0 deletions src/preset/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@import "@digitalservice4germany/angie/fonts.css";

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
body {
@apply font-font-family-sans font-normal;
}
}

::placeholder {
@apply font-font-family-sans not-italic;
}
15 changes: 15 additions & 0 deletions src/preset/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "./global.css";

import button from "@/preset/button/button";
import inputGroup from "@/preset/inputGroup/inputGroup";
import inputGroupAddon from "@/preset/inputGroup/inputGroupAddon";
import inputText from "@/preset/inputText/inputText";
import password from "@/preset/password/password";

export default {
button,
inputText,
inputGroup,
inputGroupAddon,
password,
};
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="vite/client" />
/// <reference types="unplugin-icons/types/vue3" />
27 changes: 0 additions & 27 deletions tsconfig.app.json

This file was deleted.

41 changes: 32 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
"compilerOptions": {
"composite": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"target": "ES2020",
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"useDefineForClassFields": true,

/* Bundler mode */
"allowImportingTsExtensions": true,
"isolatedModules": true,
"jsx": "preserve",
"moduleDetection": "force",
"moduleResolution": "bundler",
"noEmit": true,
"resolveJsonModule": true,

/* Linting */
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,

/* Aliases */
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
},

"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],

"references": [{ "path": "./tsconfig.node.json" }]
}
12 changes: 6 additions & 6 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"moduleResolution": "bundler",
"skipLibCheck": true,
"strict": true,
"noEmit": true
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
},
"include": ["vite.config.ts"]

"include": ["**/*.config.ts", "./storybook/*.ts"]
}
21 changes: 11 additions & 10 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
import icons from "unplugin-icons/vite";
import { defineConfig } from "vite";

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -12,21 +13,21 @@ export default defineConfig({
compiler: "vue3",
}),
],

resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},

build: {
outDir: "dist",
lib: {
entry: "src/index.ts",
entry: "src/preset/index.ts",
name: "ris-ui",
fileName: (format) => `ris-ui.${format}.js`,
formats: ["es"],
},
rollupOptions: {
external: ["vue", "primevue"],
output: {
globals: {
vue: "Vue",
primevue: "PrimeVue",
},
},
},
},
});

0 comments on commit 815dcc1

Please sign in to comment.