SAP / fundamental-react

React implementation of the reusable component library designed in Fundamental Library Styles
https://sap.github.io/fundamental-react
Apache License 2.0
189 stars 77 forks source link

Fix Import component on playground #239

Closed greg-a-smith closed 5 years ago

greg-a-smith commented 5 years ago

The Import component for the playground is showing imports as:

import { ActionBar } from '/fundamental-react/src/';

This is not correct or how a consumer would truly import the component.

Consider showing tree-shakable imports that import directly from the path in addition to named imports (like shown above).

PierreFritsch commented 5 years ago

@greg-a-smith for the time being until this is fixed, is there a way for consumers to use the components?

In other words, how would I reference a component such as ActionBar from my app after doing npm install --save fiori-fundamentals fundamental-react and importing ../node_modules/fiori-fundamentals/scss/all.scss in my App.scss file?

I tried with import { ActionBar } from '../node_modules/fundamental-react/dist/'; but it doesn't seem to be the way to go:

screenshot 2019-01-21 at 13 42 50

(My guess is that I'd have to wait for https://github.com/SAP/fundamental-react/issues/113 first, right? )

CodesOfRa commented 5 years ago

Hi @PierreFritsch

I did a tiny sample app here : https://github.com/CodesOfRa/fundamental-react-demo

if you want to use a component you can use

import {Button} from 'fundamental-react/dist/Button/Button';

let me know if this is helping you.

PierreFritsch commented 5 years ago

Thanks @CodesOfRa - yes that helps!

From my point of view, it would make sense to include the contents of your sample project's README in the README file of this repository. That's exactly what I would expect as an external consumer under the section "Getting Started" (EDIT: or a section called "Usage" to keep it in sync with the docs of fundamental-vue)

CodesOfRa commented 5 years ago

@PierreFritsch We are working on that, we have an issue open for this - to add some sample apps as part for documentation/Readme