-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7457cfb
commit f3b3d09
Showing
15 changed files
with
94 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "fastui-bootstrap", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"build": "tsc", | ||
"typecheck": "tsc --noEmit", | ||
"typewatch": "tsc --noEmit --watch" | ||
}, | ||
"dependencies": { | ||
"bootstrap": "^5.3.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"sass": "^1.69.5" | ||
}, | ||
"peerDependencies": { | ||
"fastui": "0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ClassNameGenerator, CustomRender } from 'fastui' | ||
|
||
export const customRender: CustomRender = (props) => { | ||
const { type } = props | ||
if (type === 'DisplayPrimitive') { | ||
const { value } = props | ||
if (typeof value === 'boolean') { | ||
return () => <>{value ? '👍' : '👎'}</> | ||
} | ||
} | ||
} | ||
|
||
export const classNameGenerator: ClassNameGenerator = (props) => { | ||
const { type } = props | ||
switch (type) { | ||
case 'Page': | ||
return 'container py-4' | ||
case 'Row': | ||
return 'row' | ||
case 'Col': | ||
return 'col' | ||
case 'Button': | ||
return 'btn btn-primary' | ||
case 'Table': | ||
return 'table table-striped' | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../packages-dist", | ||
"paths": { | ||
"fastui": ["../fastui/src"] | ||
} | ||
}, | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,10 @@ | ||
import { FastUI, ClassNameGenerator, CustomRender } from 'fastui' | ||
import { FastUI } from 'fastui' | ||
import * as bootstrap from 'fastui-bootstrap' | ||
|
||
export default function App() { | ||
return ( | ||
<div className="app"> | ||
<FastUI rootUrl="/api" classNameGenerator={bootstrapClassName} customRender={customRender} /> | ||
<FastUI rootUrl="/api" classNameGenerator={bootstrap.classNameGenerator} customRender={bootstrap.customRender} /> | ||
</div> | ||
) | ||
} | ||
|
||
const customRender: CustomRender = (props) => { | ||
const { type } = props | ||
if (type === 'DisplayPrimitive') { | ||
const { value } = props | ||
if (typeof value === 'boolean') { | ||
return () => <>{value ? '👍' : '👎'}</> | ||
} | ||
} | ||
} | ||
|
||
const bootstrapClassName: ClassNameGenerator = (props) => { | ||
const { type } = props | ||
switch (type) { | ||
case 'Page': | ||
return 'container py-4' | ||
case 'Row': | ||
return 'row' | ||
case 'Col': | ||
return 'col' | ||
case 'Button': | ||
return 'btn btn-primary' | ||
case 'Table': | ||
return 'table table-striped' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters