Skip to content

Instantly share code, notes, and snippets.

@deyceg
deyceg / Button.tsx
Last active August 9, 2022 10:25
React + Tailwindcss
type TailwindButtonProps = {
/**
* Text to render on the button
*/
text?: string;
/**
* Click handler
*/
onClick: React.MouseEventHandler<HTMLButtonElement>;
/**
'use strict'
const User = use('App/Model/User')
class RegisterController {
* register (request, response) {
console.log('register api');
const user = new User()
@deyceg
deyceg / sfAccordion.js
Last active April 17, 2017 13:58
Schema Form + UI Bootstrap Accordion
'use strict';
angular
.module('schema-form-accordion')
.directive('sfAccordion', sfAccordion);
function sfAccordion($timeout) {
var ddo = {
restrict: 'A',
require: ['^ngModel', '^accordion', '^form'],
// in constructor iterate over FormWrapper instance this.props.children and decorate "*Field" with <Field>
decorateFields = (element) => {
const { props: { children } = {} } = element;
const { type: { name } = {} } = element;
if (typeof element === 'string' || typeof element.type === 'string') return element;
//Editable has prop component which is <InlineSelectField> that never gets decorated
<Editable>
<p>My name is <TextField ... /> and I am <Dropdown options={['awesome', 'awesome', 'awesome'] />.</p>
</Editable>
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Exemplar = function () {
function Exemplar() {
_classCallCheck(this, Exemplar);
}
var RadioGroupControl=exports.RadioGroupControl=function(props){
<Accordion>
<PanelHeader>Your Risk Illustration</PanelHeader>
<PanelContent>
<Illustration id="risk" /> { /* Dynamically load widget from CDN. Different "house view" loads different widget */ }
</PanelContent>
</Accordion>
function LibraryCtrl($scope, LibraryService, artists) { //assumming you're favoring $scope over this
$scope.artists = artists || []; //defensive
$scope.albums = [];
$scope.selectedArtist = null;
activate(); //I like to put my activation logic in a function, and call it
function activate() {
$scope.selectedArtist = LibraryService.getSelectedArtist();
<QuestionGroup key="parent">
<CollapsablePanelContainer>
<Panel>
<PanelHeaderLayout>
<PanelHeader />
</PanelHeaderLayout>
<PanelContentLayout>
<Question key="child" /> // should render out as parent.child
</PanelContentLayout>
</Panel>