Skip to content

Commit

Permalink
refactor(meter): ♻️ remove __examples__ to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Oct 16, 2020
1 parent ec6b984 commit 1f63176
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 50 deletions.
2 changes: 1 addition & 1 deletion babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ module.exports = function (api) {
return {
presets,
plugins,
ignore: ["**/*/__tests__", "**/*/stories", "**/*/__examples__"],
ignore: ["**/*/__tests__", "**/*/stories"],
};
};
8 changes: 0 additions & 8 deletions bundlesize.config.json

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"build-storybook": "build-storybook",
"build:cjs": "cross-env BABEL_ENV=cjs babel src --extensions .ts,.tsx --config-file ./babel-config.js -d dist/cjs --source-maps",
"build:esm": "cross-env BABEL_ENV=esm babel src --extensions .ts,.tsx --config-file ./babel-config.js -d dist/esm --source-maps",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
"bundlesize": "bundlesize",
"build:types": "tsc --emitDeclarationOnly",
"commit": "gacp",
"format": "prettier --write \"./**/*.{js,ts,css,less,json,md,html,yml,yaml,pcss,jsx,tsx}\"",
"keys": "node scripts/build/keys",
Expand Down Expand Up @@ -91,7 +90,6 @@
"babel-loader": "^8.1.0",
"babel-plugin-chakra-ui": "1.0.0-rc.5",
"babel-plugin-date-fns": "^2.0.0",
"bundlesize": "0.18.0",
"chalk": "4.1.0",
"concurrently": "5.3.0",
"conventional-github-releaser": "3.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { render } from "reakit-test-utils";
import { renderHook } from "reakit-test-utils/hooks";
import { jestSerializerStripFunctions } from "reakit-test-utils/jestSerializerStripFunctions";

import { MeterComp } from "../index";
import { Meter } from "../Meter";
import { data } from "./statehook-test-data";
import { useMeterState, UseMeterProps } from "../../index";

Expand All @@ -14,6 +14,20 @@ function renderMeterStateHook(props: UseMeterProps = {}) {
return renderHook(() => useMeterState(props)).result;
}

const MeterComp: React.FC<UseMeterProps> = props => {
const { value, low, high, optimum, min, max, ...rest } = props;
const meter = useMeterState({
value,
low,
high,
optimum,
min,
max,
});

return <Meter {...meter} {...rest} />;
};

describe("Meter", () => {
test("default meter markup", () => {
const { container } = render(<MeterComp />);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import { Meta } from "@storybook/react";

import { Meter } from "../../Meter";
import { useMeterState } from "../../index";
import { Meter } from "../Meter";
import { useMeterState } from "../index";
import {
useFakeProgression,
createCircularExample,
} from "../../../progress/stories/storybook-progress-utils";
} from "../../progress/stories/storybook-progress-utils";

export default {
title: "Meter/Circular",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Meta, Story } from "@storybook/react";

import { IStyledMeter, StyledMeter as Meter } from "../index";
import { IStyledMeter, StyledMeter as Meter } from "./Meter";

export default {
component: Meter,
Expand Down
14 changes: 0 additions & 14 deletions src/meter/__examples__/index.tsx → src/meter/stories/Meter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@ import { MeterStateReturn } from "../MeterState";
import { Meter, useMeterState, UseMeterProps } from "../index";
import { generateStripe } from "../../progress/stories/storybook-progress-utils";

export const MeterComp: React.FC<UseMeterProps> = props => {
const { value, low, high, optimum, min, max, ...rest } = props;
const meter = useMeterState({
value,
low,
high,
optimum,
min,
max,
});

return <Meter {...meter} {...rest} />;
};

// CSS Styles from https://css-tricks.com/html5-meter-element/
const meterStyle = css({
position: "relative",
Expand Down
33 changes: 14 additions & 19 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,25 @@
"target": "es5",
"module": "esnext",
"lib": ["dom", "esnext"],
"declaration": true,
"declarationDir": "dist/types",
"sourceMap": true,
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"skipLibCheck": true,
"downlevelIteration": true,
"resolveJsonModule": true,
"strict": false,
"noFallthroughCasesInSwitch": true,
"suppressImplicitAnyIndexErrors": true,
"noImplicitAny": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"resolveJsonModule": true,
"types": ["node", "jest", "@testing-library/jest-dom"]
"suppressImplicitAnyIndexErrors": true,
"noImplicitAny": true,
"noFallthroughCasesInSwitch": true,
"types": ["node", "jest", "@testing-library/jest-dom"],
"sourceMap": true,
"declaration": true,
"declarationDir": "dist/types"
},
"exclude": [
"node_modules",
"dist",
"**/*/stories",
"**/*/__tests__",
"**/*/__examples__"
]
"include": ["src"],
"exclude": ["**/*/stories", "**/*/__tests__"]
}

0 comments on commit 1f63176

Please sign in to comment.