canonical-web-and-design / vanilla-framework-react Goto Github PK
View Code? Open in Web Editor NEWAn implementation of Vanilla Framework using React
An implementation of Vanilla Framework using React
Currently, tests fail. If I run npm run test
and then press a
, I get:
FAIL src/components/App/App.test.js
● Test suite failed to run
Cannot find module './App.css' from 'App.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<anonymous> (src/components/App/App.js:5:76)
FAIL src/components/Button/Button.test.js
● Test suite failed to run
Cannot find module './Button.css' from 'Button.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<anonymous> (src/components/Button/Button.js:3:1)
FAIL src/components/Card/Card.test.js
● Test suite failed to run
Cannot find module './Card.css' from 'Card.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<anonymous> (src/components/Card/Card.js:3:1)
Test Suites: 3 failed, 3 total
Tests: 0 total
Snapshots: 0 total
Time: 1.384s
Ran all test suites.
Watch Usage: Press w to show more.
Subtypes:
https://reactjs.org/docs/react-api.html#reactpurecomponent
Most of vanillas patterns and components are fairly simple with predictable and repeatable renders so could benefit from PureComponents. If unsure stick with normal components.
npm start
The version of Vanilla Framework being imported is 1.5.4 which includes the Switch component styling - as verified on Codepen
If you inspect the component, no styles seem to be applied to .p-switch
Any ideas @anthonydillon or @Lukewh?
For now, add base Table and Table sortable components. Table expandable and Table mobile card to come later.
This project has been published to NPM here...
https://www.npmjs.com/package/vanilla-framework-react
This is so that it can be added as a dep to another React project and individual components can then be added as needs be, but that ain't currently working, see:
At the moment, all the testing is done via Jest's snapshot comparison tool. This is okay for pure UI components, but it is not adequate for components with internal logic/state (e.g. accordion, table).
Subypes:
In Storybook, components show against the sidebar with no padding.
Matrix stands out as one which has this problem.
One option to tackle this is to import a stylesheet into .storybook/config.js
and add padding. This can be done simply by adding `import './storybook.scss'.
I believe the layout of the page can also be tweaked in config.
To help with packaging components as individual pieces have you considered compiling separately?
There's been talk of making the patterns mix-and-match so why not do the same with the React components.
A component file structure could be like:
components/
Button/
Button.js
Button.scss
Button.css
Button.js
would import './Button.css'
.Button.css
would contain the compiled code for Button.scss
.Btutton.scss
would be @import 'vanilla-framework/scss/_patterns_buttons.scss'
.It seems convoluted, and maybe a better way would be to automate the compilation to each folder (removing the need for Button.scss
). Or maybe an even better way would be not to do this at all.
Just an idea, and open to discussion/ being shot down.
Buttons are looking good. Have you thought of creating a single button component with a prop of type [brand, positive, negative]?
This would make the component more DRY.
Subtypes:
I wouldn't expect AccordionItem to manage it's own state as implementing a true single-item-open accordion requires the state of all items to be known.
I'd expect Accordion to pass it's own methods for manipulating it's children to the AccordionItem's for onclick handlers etc. This would make the Accordion component a more generic wrapper.
When I'm back at work next week I'll better explain what I mean in comment.
Subtypes:
Subtypes:
Currently the Accordion.js file is hard-coded with AccordionItems and corresponding text. It should be customisable.
Subtypes:
Subtypes:
Functional component names get minified with other javascript code when building for production, so they're showing up as Unknown on https://vanilla-framework.github.io/vanilla-framework-react/. It would also help for debugging when using React Developer Tools on production builds.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.