Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Remove vite-inline-css plugin #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"vite-plugin-checker": "^0.4.6",
"vite-plugin-environment": "^1.1.1",
"vite-plugin-fonts": "^0.4.0",
"vite-plugin-inline-css-modules": "^0.0.4",
"vite-plugin-windicss": "^1.8.4",
"vitest": "^0.14.2",
"windicss": "^3.5.4"
Expand Down
23 changes: 23 additions & 0 deletions src/renderer/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,28 @@ div.pre {
font-family: "Space Mono", monospace;
}

.wb-icon-btn {
@apply p-3 hover:bg-contrast/20 active:bg-contrast/30 rounded-full transition duration-100;
}

.account-view {
@apply w-full h-full border-collapse overflow-auto text-xs;

& th:not(:global(.text-center)) {
@apply text-left;
}

& th svg {
@apply inline-block;
}
}
.chip {
@apply bg-surface-100 border-2 border-surface-300/50 w-min p-1 px-2 rounded-full select-none cursor-pointer bg-opacity-10 transition duration-100 hover:bg-surface-300 whitespace-nowrap;

&-active {
@apply bg-primary-base;
}
}

// Import all of bootstrap, this isn't an exercise in minimisation
// @import "bootstrap/scss/bootstrap";
16 changes: 1 addition & 15 deletions src/renderer/components/ProgramChangeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useEffect, useState } from 'react';
import { Button } from 'react-bootstrap';
import { NavLink } from 'react-router-dom';
import { toast } from 'react-toastify';
import { css } from 'vite-plugin-inline-css-modules';
import {
accountsActions,
selectAccountsListState,
Expand Down Expand Up @@ -47,19 +46,6 @@ interface PinnedAccountMap {
[pubKey: string]: boolean;
}

const classes = css`
.account-view {
@apply w-full h-full border-collapse overflow-auto text-xs;
& th:not(:global(.text-center)) {
@apply text-left;
}

& th svg {
@apply inline-block;
}
}
`;

function ProgramChangeView() {
const dispatch = useAppDispatch();
const { net, status } = useAppSelector(selectValidatorNetworkState);
Expand Down Expand Up @@ -313,7 +299,7 @@ function ProgramChangeView() {
</span>
<div className="flex-1 block min-h-0 overflow-auto">
{displayList.length > 0 ? (
<table className={classes['account-view']}>
<table className="account-view">
<thead>
<tr className="bg-surface-400">
<th className="text-center">
Expand Down
14 changes: 1 addition & 13 deletions src/renderer/components/base/Chip.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
import { css } from 'vite-plugin-inline-css-modules';

const classes = css`
.chip {
@apply bg-surface-100 border-2 border-surface-300/50 w-min p-1 px-2 rounded-full select-none cursor-pointer bg-opacity-10 transition duration-100 hover:bg-surface-300 whitespace-nowrap;

&.active {
@apply bg-primary-base;
}
}
`;

const Chip: React.FC<
React.DetailedHTMLProps<
React.ButtonHTMLAttributes<HTMLButtonElement>,
Expand All @@ -20,7 +8,7 @@ const Chip: React.FC<
> = ({ children, active, ...rest }) => {
return (
<button
className={`${classes.chip} ${active ? classes.active : undefined}`}
className={`chip ${active && 'chip-active'}`}
type="button"
{...rest}
>
Expand Down
23 changes: 1 addition & 22 deletions src/renderer/components/base/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
import classNames from 'classnames';
import { css } from 'vite-plugin-inline-css-modules';

const classes = css`
.btn {
@apply p-3 hover:bg-contrast/20 active:bg-contrast/30 rounded-full transition duration-100;

&.dense {
@apply p-1;
}
}
`;

const IconButton: React.FC<
{
dense?: boolean;
Expand All @@ -20,15 +7,7 @@ const IconButton: React.FC<
>
> = ({ children, className, dense, ...rest }) => {
return (
<button
type="button"
className={classNames(
classes.btn,
dense ? classes.dense : undefined,
className
)}
{...rest}
>
<button type="button" className={`wb-icon-btn ${dense && 'p-1'}`} {...rest}>
{children}
</button>
);
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import IconsResolver from 'unplugin-icons/resolver';
import Icons from 'unplugin-icons/vite';
import { defineConfig } from 'vite';
import ViteFonts from 'vite-plugin-fonts';
import InlineCSSModules from 'vite-plugin-inline-css-modules';
import WindiCSS from 'vite-plugin-windicss';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import checker from 'vite-plugin-checker';
Expand Down Expand Up @@ -48,7 +47,6 @@ export default defineConfig({
families: ['Roboto:wght@400;500;700', 'Space Mono:wght@400'],
},
}),
InlineCSSModules(),
Icons({
compiler: 'jsx',
jsx: 'react',
Expand Down