Skip to content

Commit

Permalink
feat(checkbox): ✨ use reakit for custom checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Aug 19, 2021
1 parent 656efb4 commit 419243c
Show file tree
Hide file tree
Showing 22 changed files with 378 additions and 655 deletions.
23 changes: 19 additions & 4 deletions scripts/generateKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ function makeKeys(rootPath) {
keys[getModuleName(node)] = [...stateKeys, ...props];
}
}
if (isInitialStateDeclaration(node)) {
const literalNode = isOptionsDeclaration(node)
? getLiteralNode(node)
: node;
const props = literalNode ? getPropsNames(literalNode, true) : [];
keys[getModuleName(node)] = props;
}
});
});

Expand Down Expand Up @@ -206,6 +213,17 @@ function isStateReturnDeclaration(node) {
);
}

/**
* @param {import("ts-morph").Node<Node>} node
*/
function isInitialStateDeclaration(node) {
const kindName = node.getKindName();
const escapedName = getEscapedName(node);
return (
kindName === "TypeAliasDeclaration" && /.+InitialState$/.test(escapedName)
);
}

/**
* @param {import("ts-morph").Node<Node>} node
*/
Expand Down Expand Up @@ -365,10 +383,7 @@ function reduceKeys(acc, [moduleName, array]) {

const finalString = `${declaration} = ${value};\n`;

if (!moduleName.endsWith("State")) {
return `${acc}export ${finalString}`;
}
return `${acc}${finalString}`;
return `${acc}export ${finalString}`;
}

function log(...args) {
Expand Down
44 changes: 0 additions & 44 deletions src/CheckboxTw/CheckboxDescription.tsx

This file was deleted.

73 changes: 0 additions & 73 deletions src/CheckboxTw/CheckboxIcon.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions src/CheckboxTw/CheckboxInput.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions src/CheckboxTw/CheckboxLabel.tsx

This file was deleted.

86 changes: 0 additions & 86 deletions src/CheckboxTw/CheckboxState.ts

This file was deleted.

39 changes: 0 additions & 39 deletions src/CheckboxTw/CheckboxText.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/CheckboxTw/index.ts

This file was deleted.

Loading

0 comments on commit 419243c

Please sign in to comment.