Added LinksGrid components, updated documentation

This commit is contained in:
2024-12-07 23:31:31 +09:00
parent e821b258c3
commit 9dea40236e
24 changed files with 278 additions and 141 deletions

View File

@@ -31,12 +31,14 @@ const asyncDatabaseRead = async <Type>(
callback: asyncDatabaseRowsCallbackFunction
): Promise<Type> => {
return new Promise((resolve, reject) => {
database.all(sqlQuery, (error: Error, rows: any) => {
if (error !== null) {
reject(error);
} else {
resolve(callback(rows));
}
database.serialize(() => {
database.all(sqlQuery, (error: Error, rows: any) => {
if (error !== null) {
reject(error);
} else {
resolve(callback(rows));
}
});
});
});
};
@@ -57,12 +59,14 @@ const asyncDatabaseWrite = async <Type>(
callback: asyncDatabaseVoidCallbackFunction
): Promise<Type> => {
return new Promise((resolve, reject) => {
database.run(sqlQuery, (error: Error) => {
if (error !== null) {
reject(error);
} else {
resolve(callback());
}
database.serialize(() => {
database.run(sqlQuery, (error: Error) => {
if (error !== null) {
reject(error);
} else {
resolve(callback());
}
});
});
});
};

33
utils/types/linksGrid.ts Normal file
View File

@@ -0,0 +1,33 @@
/**
* Types for LinksGrid component
* @module utils/types/linksGrid
*/
import type { LinkCardProperty } from "./linkCard";
/**
* Interface that defines property for LinksGrid component
* @property {Array<LinkCardProperty>} links Array of property of LinkCard components
* @example
* const linksList = [
* {
* title: "test 1",
* description: "Test Page #1",
* link: "/test/1",
* imagePath: "/images/test-1.png",
* },
* ...
* {
* title: "test n",
* description: "Test Page #n",
* link: "/test/n",
* imagePath: "/images/test-n.png",
* },
* ];
* <LinksGrid :links="linksList" />
*/
interface LinksGridProperty {
links: Array<LinkCardProperty>;
}
export type { LinksGridProperty };

View File

@@ -1,6 +1,6 @@
/**
* Types for Slide component
* @module utils/types/slide.ts
* @module utils/types/slide
*/
/**