Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Added version to fetch props. Renamed interfaces to a declaration file
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Berg Alstad committed Apr 8, 2023
1 parent 3245769 commit 292da46
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component, createSignal } from "solid-js";
import type { ButtonProps, TitleProps } from "../types/interfaces";
import type { ButtonProps, TitleProps } from "../types/types";

interface SwitchProps extends TitleProps {
defaultValue?: boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/components/card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { CardProps } from "../types/interfaces";
import type { CardProps } from "../types/types";
import { Link } from "./link";

const Card: Component<CardProps> = ({ children, className, title, to, newTab = false }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { Dialog, DialogDescription, DialogPanel, DialogTitle } from "solid-headless";
import type { TitleProps } from "../types/interfaces";
import type { TitleProps } from "../types/types";
import { createEffect, createSignal, JSX } from "solid-js";
import { Button } from "./button";
import { Portal } from "solid-js/web";
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { SimpleProps } from "../types/interfaces";
import type { SimpleProps } from "../types/types";
import { Link } from "./link";

const Footer: Component<SimpleProps> = ({ className }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component, Show } from "solid-js";
import type { TitleProps } from "../types/interfaces";
import type { TitleProps } from "../types/types";
import { Icon } from "solid-heroicons";
import { chevronLeft } from "solid-heroicons/solid";
import { Link } from "./link";
Expand Down
2 changes: 1 addition & 1 deletion src/components/input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component, createSignal, JSX, Setter } from "solid-js";
import type { InputProps } from "../types/interfaces";
import type { InputProps } from "../types/types";
import Row from "./row";

function setupEventListener(id: string, setIsHover: Setter<boolean>): () => void {
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { TitleProps } from "../types/interfaces";
import type { TitleProps } from "../types/types";
import Header from "./header";
import Footer from "./footer";

Expand Down
2 changes: 1 addition & 1 deletion src/components/link.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { LinkProps } from "../types/interfaces";
import type { LinkProps } from "../types/types";

export const Link: Component<LinkProps> = (
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* @refresh reload */
import type { TitleProps } from "../types/interfaces";
import type { TitleProps } from "../types/types";
import { type Component, createEffect, createSignal, JSX, Show } from "solid-js";
import { Button } from "./button";

Expand Down
2 changes: 1 addition & 1 deletion src/components/output.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Disclosure, DisclosureButton, DisclosurePanel, Transition } from "solid-headless";
import { Icon } from "solid-heroicons";
import type { ChildProps, TitleProps } from "../types/interfaces";
import type { ChildProps, TitleProps } from "../types/types";
import { Component, JSX } from "solid-js";
import { chevronUp } from "solid-heroicons/solid";

Expand Down
2 changes: 1 addition & 1 deletion src/components/row.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import { type Component } from "solid-js";
import type { ChildProps } from "../types/interfaces";
import type { ChildProps } from "../types/types";

const Row: Component<ChildProps> = ({ children, className }) => {
return <div class={ `flex-row-center ${ className }` }>{ children }</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/truth-table.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @refresh reload */
import type { SimpleProps } from "../types/interfaces";
import type { Table } from "../types/interfaces";
import type { SimpleProps } from "../types/types";
import type { Table } from "../types/types";
import { For } from "solid-js/web";
import { type Component } from "solid-js";

Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "./index.css";
import { type Component } from "solid-js";
import Layout from "./components/layout";
import Card from "./components/card";
import type { CardProps } from "./types/interfaces";
import type { CardProps } from "./types/types";
import { Link } from "./components/link";

const apiRoot = "https://api.martials.no";
Expand Down
2 changes: 1 addition & 1 deletion src/truth-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TruthTable from "./components/truth-table";
import { InfoBox, MyDisclosure, MyDisclosureContainer } from "./components/output";
import { diffChars } from "diff";
import MyMenu from "./components/menu";
import type { FetchResult } from "./types/interfaces";
import type { FetchResult } from "./types/types";
import { type Accessor, type Component, createSignal, JSX, onMount, Show } from "solid-js";
import { For, render } from "solid-js/web";
import Row from "./components/row";
Expand Down
File renamed without changes.
25 changes: 13 additions & 12 deletions src/types/interfaces.ts → src/types/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import { JSX } from "solid-js";

export interface SimpleProps {
interface SimpleProps {
name?: string;
className?: string,
style?: JSX.CSSProperties,
id?: string,
title?: string,
}

export interface ChildProps extends SimpleProps {
interface ChildProps extends SimpleProps {
children?: JSX.Element,
}

export interface LinkProps extends ChildProps {
interface LinkProps extends ChildProps {
to?: string,
rel?: string,
newTab?: boolean,
}

export interface TitleProps extends ChildProps {
interface TitleProps extends ChildProps {
title?: string,
}

export interface ButtonProps extends TitleProps {
interface ButtonProps extends TitleProps {
onClick?: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>,
type?: "button" | "submit" | "reset",
}

export interface InputProps<T> extends TitleProps {
interface InputProps<T> extends TitleProps {
onInput?: JSX.EventHandlerUnion<T, Event>,
placeholder?: string | null,
required?: boolean,
type?: string,
}

export interface CardProps extends LinkProps {
interface CardProps extends LinkProps {
title?: string;
}

export type Expression = {
type Expression = {
leading: string,
left: Expression | null,
operator: Operator | null,
Expand All @@ -47,18 +47,19 @@ export type Expression = {
atomic: string | null,
};

export type Operator = "AND" | "OR" | "NOT" | "IMPLICATION";
type Operator = "AND" | "OR" | "NOT" | "IMPLICATION";

export type Table = boolean[][];
type Table = boolean[][];

export type OrderOfOperations = {
type OrderOfOperations = {
before: string,
after: string,
law: string,
}[];

export type FetchResult = {
type FetchResult = {
status: string,
version: string | null,
before: string,
after: string,
orderOperations: OrderOfOperations | null,
Expand Down

0 comments on commit 292da46

Please sign in to comment.