├── .gitignore ├── .vscode └── extensions.json ├── src ├── repositories │ ├── book │ │ ├── index.ts │ │ ├── BookRepository.ts │ │ └── types.ts │ ├── httpClient.ts │ └── RepositoryFactory.ts ├── Tailwindcss.svelte ├── main.ts ├── router │ └── index.ts ├── components │ ├── Spinner.svelte │ ├── Row.svelte │ ├── SearchBar.svelte │ ├── Header.svelte │ ├── BookCard.svelte │ └── BookInfo.svelte ├── App.svelte ├── store │ └── book │ │ └── index.ts └── pages │ ├── DetailsBook.svelte │ └── SearchBook.svelte ├── public ├── favicon.png └── index.html ├── postcss.config.js ├── tsconfig.json ├── tailwind.config.js ├── README.md ├── package.json └── rollup.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["svelte.svelte-vscode"] 3 | } 4 | -------------------------------------------------------------------------------- /src/repositories/book/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types' 2 | export * from './BookRepository' -------------------------------------------------------------------------------- /public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azukiazusa1/svelte-book-review-app/HEAD/public/favicon.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /src/Tailwindcss.svelte: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ 4 | target: document.body, 5 | }); 6 | 7 | export default app; -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/svelte/tsconfig.json", 3 | 4 | "include": ["src/**/*"], 5 | "exclude": ["node_modules/*", "__sapper__/*", "public/*"] 6 | } -------------------------------------------------------------------------------- /src/repositories/httpClient.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | const httpClient = axios.create({ 4 | baseURL: 'https://www.googleapis.com/books/v1/volumes' 5 | }) 6 | 7 | export { httpClient } -------------------------------------------------------------------------------- /src/router/index.ts: -------------------------------------------------------------------------------- 1 | import SearchBook from '../pages/SearchBook.svelte' 2 | import DetailsBook from '../pages/DetailsBook.svelte' 3 | 4 | export const routes = { 5 | '/': SearchBook, 6 | '/books/:id': DetailsBook, 7 | } -------------------------------------------------------------------------------- /src/repositories/RepositoryFactory.ts: -------------------------------------------------------------------------------- 1 | import { BookRepository, BookRepositoryInterface } from './book' 2 | 3 | export const BOOK = Symbol('book') 4 | 5 | export interface Repositories { 6 | [BOOK]: BookRepositoryInterface; 7 | } 8 | 9 | export default { 10 | [BOOK]: new BookRepository() 11 | } as Repositories 12 | -------------------------------------------------------------------------------- /src/components/Spinner.svelte: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/Row.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
14 |
15 |
16 |
17 |
18 | Svelteを使ってアプリケーションを作成1から作成することができます。
19 | 以下のことが学べます。
20 |
21 | - Svelteの基礎文法
22 | - Svelteのルーティング
23 | - Svelteのストア
24 |
25 | HTML・CSS・JavaScriptの基礎的な理解がある人が対象です。
26 |
--------------------------------------------------------------------------------
/src/repositories/book/types.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Google Books APIのレスポンス
3 | */
4 | export interface Result {
5 | items: BookItem[];
6 | kind: string;
7 | totalItems: number;
8 | }
9 |
10 | /**
11 | * 本の情報
12 | */
13 | export interface BookItem {
14 | id: string;
15 | volumeInfo: {
16 | title: string;
17 | authors?: string[];
18 | publishedDate?: string;
19 | description?: string;
20 | publisher?: string;
21 | imageLinks?: {
22 | smallThumbnail: string;
23 | thumbnail: string;
24 | };
25 | pageCount: number;
26 | previewLink?: string;
27 | };
28 | saleInfo?: {
29 | listPrice: {
30 | amount: number;
31 | };
32 | };
33 | }
34 |
35 | /**
36 | * query parameters
37 | */
38 | export interface Params {
39 | q: string;
40 | startIndex?: number;
41 | }
42 |
43 | export interface BookRepositoryInterface {
44 | get(params: Params): Promise25 | {description} 26 |
27 |