Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
40cbcc8
delete old components
leadwolf Nov 25, 2018
60254ec
create base Toggle
leadwolf Nov 25, 2018
134788a
feat: create Row
leadwolf Nov 25, 2018
6be8653
stories: create WithExpandedRowIdsState
leadwolf Nov 25, 2018
b155953
fix(Row): wrong style props
leadwolf Nov 25, 2018
0856ffd
refactor(Row): add noIndent prop
leadwolf Nov 25, 2018
bda2666
stories(Row): add table example
leadwolf Nov 25, 2018
2073ea7
stories(Row): add header
leadwolf Nov 25, 2018
ecd2992
feat: create Cell & Header
leadwolf Nov 25, 2018
7cd269c
stories(ROw): use Cell
leadwolf Nov 25, 2018
7ab357d
stories(Row): remove useless styles
leadwolf Nov 25, 2018
f5a0285
feat: create Table
leadwolf Nov 25, 2018
47dea4c
stories(Tree): create example with multiple roots
leadwolf Nov 25, 2018
24a0fff
core: export components
leadwolf Nov 25, 2018
93ea7cc
stories: add withInfo decorator
leadwolf Nov 25, 2018
2f82c23
docs: document Row props
leadwolf Nov 25, 2018
695c396
feat(Row): add renderChildren override function
leadwolf Nov 25, 2018
d825e2d
stories(Tree): cleanup render prop
leadwolf Nov 25, 2018
9835283
refactor(WithExpandedRowIdsState): change render prop so it show in s…
leadwolf Nov 25, 2018
4640422
stories: add storysource addon
leadwolf Nov 25, 2018
3c92a04
stories: use addon actions for 'toggle'
leadwolf Nov 25, 2018
ff7b3f7
stories: add ga
leadwolf Nov 25, 2018
7b528af
core: change version
leadwolf Nov 25, 2018
1891324
core: install @storybook/addon-storysource as dev dependency
leadwolf Nov 25, 2018
ba9cf56
refactor(Row): add default render for content
leadwolf Nov 25, 2018
c22926f
stories(Row): make custom render example more explicit
leadwolf Nov 25, 2018
5bb630a
stories: fix duplicate click handler
leadwolf Nov 25, 2018
6e32d69
fix(Row): only set pointer style if hasChildren
leadwolf Nov 25, 2018
7a64a3a
fix(DefaultContent): remove useless padding
leadwolf Nov 25, 2018
694383e
stories: fix css conflicts
leadwolf Nov 25, 2018
3fa925b
stories(Tree): add all borders for multi roots example
leadwolf Nov 25, 2018
b776f91
refactor: rename Header to RowLayout
leadwolf Nov 25, 2018
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
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"import/prefer-default-export": 0
"import/prefer-default-export": 0,
"react/jsx-filename-extension": 0
}
}
2 changes: 2 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-storysource/register';
import '@storybook/addon-actions/register';
5 changes: 4 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { configure } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import { configure, addDecorator } from '@storybook/react';

addDecorator(withInfo);

// automatically import all files ending in *.stories.js
const req = require.context('../src', true, /.stories.(js|jsx)$/);
Expand Down
11 changes: 11 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-129285042-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());

gtag('config', 'UA-129285042-2');
</script>
5 changes: 5 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ module.exports = {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.stories\.jsx?$/,
loaders: [require.resolve('@storybook/addon-storysource/loader')],
enforce: 'pre',
},
],
},
};
180 changes: 180 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,

// Stop running tests after the first failure
// bail: false,

// Respect "browser" field in package.json when resolving modules
// browser: false,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/tmp/jest_rs",

// Automatically clear mock calls and instances between every test
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: null,

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: null,

// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,

// Force coverage collection from ignored files usin a array of glob patterns
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: null,

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: null,

// A set of global variables that need to be available in all test environments
// globals: {},

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "node"
// ],

// A map from regular expressions to module names that allow to stub out resources with a single module
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],

// Activates notifications for test results
// notify: false,

// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "always",

// A preset that is used as a base for Jest's configuration
// preset: null,

// Run tests from one or more projects
// projects: null,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,

// Automatically reset mock state between every test
// resetMocks: false,

// Reset the module registry before running each individual test
// resetModules: false,

// A path to a custom resolver
// resolver: null,

// Automatically restore mock state between every test
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: null,

// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],

// The path to a module that runs some code to configure or set up the testing framework before each test
// setupTestFrameworkScriptFile: null,

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],

// The test environment that will be used for testing
// testEnvironment: "jest-environment-jsdom",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.js?(x)",
// "**/?(*.)+(spec|test).js?(x)"
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],

// The regexp pattern Jest uses to detect test files
// testRegex: "",

// This option allows the use of a custom results processor
// testResultsProcessor: null,

// This option allows use of a custom test runner
// testRunner: "jasmine2",

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",

// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",

// A map from regular expressions to paths to transformers
// transform: null,

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/"
// ],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: null,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
};
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-tree-view",
"version": "1.0.0",
"version": "0.1.0",
"description": "react-tree-view React component",
"main": "lib/index.js",
"module": "es/index.js",
Expand All @@ -10,14 +10,19 @@
"lib",
"umd"
],
"author": "Christopher Caroni",
"homepage": "https://react-tree-view.ccaroni.com",
"license": "MIT",
"repository": "https://github.com/Christopher-Caroni/react-tree-view",
"keywords": [
"react-component"
],
"scripts": {
"build": "nwb build-react-component",
"clean": "nwb clean-module && nwb clean-demo",
"prepublishOnly": "npm run build",
"start": "nwb serve-react-demo",
"test": "nwb test-react",
"test:coverage": "nwb test-react --coverage",
"test:watch": "nwb test-react --server",
"test": "jest",
"eslint-check": "eslint --print-config .eslintrc.json | eslint-config-prettier-check",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
Expand All @@ -29,7 +34,9 @@
"devDependencies": {
"@babel/core": "^7.1.6",
"@storybook/addon-actions": "^4.0.8",
"@storybook/addon-info": "^4.0.8",
"@storybook/addon-links": "^4.0.8",
"@storybook/addon-storysource": "^4.0.8",
"@storybook/addons": "^4.0.8",
"@storybook/react": "^4.0.8",
"babel-loader": "^8.0.4",
Expand All @@ -40,17 +47,12 @@
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-react": "^7.11.0",
"jest": "^23.6.0",
"jest-webpack": "^0.5.1",
"nwb": "0.23.x",
"nwb-sass": "^0.9.0",
"prettier": "^1.15.2",
"react": "^16.6.3",
"react-dom": "^16.6.3"
},
"author": "",
"homepage": "",
"license": "MIT",
"repository": "",
"keywords": [
"react-component"
]
}
}
24 changes: 24 additions & 0 deletions src/Cell/Cell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import './cell.scss';

import PropTypes from 'prop-types';
import React from 'react';

const Cell = ({ className, style, children }) => (
<div className={`rtv-cell ${className}`} style={style}>
{children}
</div>
);

Cell.propTypes = {
className: PropTypes.string,
style: PropTypes.object,
children: PropTypes.node,
};

Cell.defaultProps = {
className: '',
style: undefined,
children: null,
};

export { Cell };
9 changes: 9 additions & 0 deletions src/Cell/cell.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.rtv-cell {
display: flex;
align-items: center;
position: relative;
box-sizing: border-box;
min-height: 24px;

width: 200px;
}
1 change: 1 addition & 0 deletions src/Cell/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Cell';
Loading