Skip to content

Commit

Permalink
feat: properly register svg-animations to the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
joekarasek committed Sep 5, 2019
1 parent 32c3c08 commit b1e242a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
Expand Up @@ -5,12 +5,12 @@ module.exports = {
speed: {
type: 'string',
description: 'Speed of the animation, typically rotation.',
default: '1000',
default: '4000',
},
animType: {
type: 'string',
description: 'Type of predefined animated SVG to use.',
enum: ['connectionBand'],
enum: ['connectionBand', 'orbit', 'radar', 'automation'],
default: 'connectionBand',
},
direction: {
Expand Down
29 changes: 17 additions & 12 deletions packages/editor/src/setup-bolt.js
Expand Up @@ -7,6 +7,7 @@ import iconSchema from '@bolt/components-icon/icon.schema.json';
import characterSchema from '@bolt/micro-journeys/src/character.schema';
import connectionSchema from '@bolt/micro-journeys/src/connection.schema';
import statusDialogueBarSchema from '@bolt/micro-journeys/src/status-dialogue-bar.schema';
import svgAnimationsSchema from '@bolt/components-svg-animations/svg-animations.schema';
// @ts-ignore
import blockquoteSchema from '@bolt/components-blockquote/blockquote.schema.yml';
// @ts-ignore
Expand All @@ -20,6 +21,10 @@ import linkSchema from '../../components/bolt-link/link.schema.yml'; // @todo fi
// import { animationNames } from '@bolt/components-animate/animation-meta';
import { isChildOfEl, convertSchemaPropToTrait } from './utils';

console.log('Hey super smart developer, you probably want this info -> ', {
svgAnimationsSchema
});

class EditorRegisterBoltError extends Error {}

const smallButton = {
Expand Down Expand Up @@ -80,6 +85,12 @@ const link = {
content: `<bolt-link display="inline" valign="start">I'm a link</bolt-link>`,
};

const svgAnimations = {
id: 'bolt-svg-animations',
title: 'Svg Animtions',
content: `<bolt-svg-animations anim-type="orbit"></bolt-svg-animations>`,
};

const basicSlottableComponents = [
statusBar,
statusBarAlert,
Expand Down Expand Up @@ -483,6 +494,7 @@ export function setupBolt(editor) {
left: true,
right: true,
bottom: true,
background: true,
},
slotControls: [
...['top', 'right', 'bottom', 'left'].map(slotName => ({
Expand All @@ -491,7 +503,7 @@ export function setupBolt(editor) {
})),
{
slotName: 'background',
components: basicSlottableComponents,
components: [svgAnimations],
},
],
});
Expand Down Expand Up @@ -545,16 +557,9 @@ export function setupBolt(editor) {
});

registerBoltComponent({
name: 'bolt-link',
schema: linkSchema,
editable: true,
extend: 'link',
registerBlock: true,
draggable: true,
propsToTraits: ['display', 'valign', 'url', 'isHeadline'],
slots: {
default: true,
},
initialContent: [`I'm a link`],
name: 'bolt-svg-animations',
schema: svgAnimationsSchema,
registerBlock: false,
propsToTraits: ['animType', 'direction'],
});
}

0 comments on commit b1e242a

Please sign in to comment.