Skip to content

Instantly share code, notes, and snippets.

View raphaelspimenta's full-sized avatar

Raphael de Souza Pimenta raphaelspimenta

View GitHub Profile
{
"_beagleComponent_": "beagle:container",
"context": {
"id": "myContext",
"value": "Contexto Inicial"
},
"children": [
{
"_beagleComponent_": "beagle:text",
"text": "@{myContext}"
@raphaelspimenta
raphaelspimenta / beagle-remote-view
Created April 15, 2020 14:24
Beagle Remote View
// Angular way
<beagle-remote-view [loadParams]={path: '/home'}></beagle-remote-view>
// React way
<BeagleRemoteView path="/home" />
@raphaelspimenta
raphaelspimenta / basic-example-beagle.json
Last active July 3, 2020 18:20
Basic Example Beagle JSON
{
"_beagleComponent_": "beagle:container",
"children": [
{
"_beagleComponent_": "custom:filho1",
"id": "1"
},
{
"_beagleComponent_": "custom:filho2",
"id": "2"
@raphaelspimenta
raphaelspimenta / html-compare.html
Created April 14, 2020 17:52
Beagle comparation HTML
<form>
<input name="Nome" />
<input type="number" name="Idade" />
<button type="submit">Enviar</button>
</form>
@raphaelspimenta
raphaelspimenta / beagle-form-example.json
Last active July 3, 2020 18:23
beagle-form-example
{
"_beagleComponent_": "beagle:simpleform",
"children": [
{
"_beagleComponent_": "beagle:input",
"name": "Nome"
},
{
"_beagleComponent_": "beagle:input",
"name": "Idade",
@raphaelspimenta
raphaelspimenta / middleware-style.js
Last active April 15, 2020 18:32
Style Middleware
function camelCase(str) {
return str.replace(/\W+(.)/g, function(match, chr) {
return chr.toUpperCase()
})
}
function translateStyle(uiTree) {
if (uiTree.style)
uiTree.style.reduce((result, value, key) => {
delete uiTree.style[key]
{
"_beagleType_":"container",
"style": {
"display": "flex",
"flex-direction": "row",
"justify-content": "center"
}
}
@raphaelspimenta
raphaelspimenta / beagleService.js
Last active July 3, 2020 21:37
Beagle Service Config
const config = {
baseUrl: 'https://www.beagle-backend.com.br',
components: myComponentsMap,
headers: { 'access-token': myAccessToken },
strategy: 'network-with-fallback-to-cache',
}
@raphaelspimenta
raphaelspimenta / componentsMap.js
Last active July 6, 2020 12:56
Components Map
const components = {
beagle:loading: MyLoadingComponent,
beagle:error: MyErrorComponent,
custom:component: MyCustomComponent,
}
@raphaelspimenta
raphaelspimenta / react-example-beagle.json
Last active April 8, 2020 18:57
react-example-beagle.json
{
"_beagleType_":"container",
"children": [
{
"_beagleType_":"title",
"value":"Oh my! Beagle WEB actualy works..."
}
]
}