Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions models/AlertSection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: object
name: AlertSection
label: Alert Section
labelField: title
extends:
- Section
groups:
- sectionComponent
fields:
- type: text
name: body
default: 'Warning, this is an alert'
5 changes: 5 additions & 0 deletions src/components-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"modelName": null,
"isDynamic": false
},
"AlertSection": {
"path": "components/AlertSection",
"modelName": "AlertSection",
"isDynamic": true
},
"CheckboxFormControl": {
"path": "components/CheckboxFormControl",
"modelName": "CheckboxFormControl",
Expand Down
25 changes: 25 additions & 0 deletions src/components/AlertSection/alert-section.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import AlertSection from './index';

export default {
title: 'Components/AlertSection',
component: AlertSection,
argTypes: {
type: { table: { disable: true } },
elementId: {
defaultValue: ''
}
}
};

const Template = (args) => <AlertSection {...args} />;

const args = {
type: 'AlertSection',
elementId: '',
body: 'Join our club'
};

export const Primary = Template.bind({});
Primary.storyName = 'Standard Alert';
Primary.args = args;
12 changes: 12 additions & 0 deletions src/components/AlertSection/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import classNames from 'classnames';

export default function AlertSection(props) {
const cssId = props.elementId || null;
return (
<div id={cssId} className={classNames('sb-component', 'sb-component-section', 'sb-component-alert-section')}>
<h1>Alert</h1>
<p data-sb-field-path=".body">{props.body}</p>
</div>
);
}
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Action from './Action';
import AlertSection from './AlertSection';
import CheckboxFormControl from './CheckboxFormControl';
import ContactSection from './ContactSection';
import CtaSection from './CtaSection';
Expand All @@ -25,6 +26,7 @@ import VideoBlock from './VideoBlock';

export {
Action,
AlertSection,
CheckboxFormControl,
ContactSection,
CtaSection,
Expand Down