Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card View in React and Patternfly #4

Merged
merged 10 commits into from
Jun 17, 2020
Merged

Conversation

PARTHSONI95
Copy link
Contributor

Please provide your approval
Thanks!

@cfchase cfchase requested review from cfchase and crobby June 11, 2020 11:52
@@ -0,0 +1,38 @@
.App {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you're using a lot of this css. Get rid of any and all you don't need

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sir, data cleansing will be performed all over

//import accessibleStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
//import spacingStyles from '@patternfly/react-styles/css/utilities/Spacing/spacing';
//import { css } from '@patternfly/react-styles';
import imgOpenShift from './openShift.svg'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move all these images into an images folder. I think we need to embrace a directory structure that will scale as your app grows. For now I propose:

src
├── App.css
├── App.js
├── App.test.js
├── images
│   ├── airflow-2.png
│    ... more images ...
│   └── spark.png
├── index.css
├── index.js
├── Launcher
│   ├── components
│   │   ├── index.js
│   │   └── OdhAppCard.js
│   ├── index.js
│   └── Launcher.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, come up with consistent naming/capitalization for the image files, too. Names like kubeflowPng.png could be better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh yes this image isn't used - it be organized well now onwards with proper naming

skipToContent={PageSkipToContent}
mainContainerId={pageId}
>
<PageSection variant={PageSectionVariants.light}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not put all this functionality in a single App component, let's break it down. Start by creating a component called Launcher or whatever you think fits in it's own folder and use a <Launcher/> component here. It should return this PageSection as it's result. Later we'll use these sections for the routed pages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may change this later, but I tend to prefer grouping by page/route. https://reactjs.org/docs/faq-structure.html#grouping-by-features-or-routes

In this case we're building the Launcher page or feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, got your point - it makes sense

>
<PageSection variant={PageSectionVariants.light}>
<Grid hasGutter>
<GridItem span={3} style={{ borderStyle:"solid", borderColor:"#00264d" ,backgroundColor:"#E0E9F3", margin:"10px 10px 10px 10px", padding:"10px" }}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These grid items are all the same, we should iterate over data and use a subcomponent of the Launcher, for example an OdhAppCard. Then you could clean this up like:

const odhApps = [
  {
    img: imgJupyter,
    link: 'https://jupyterhub-odhdemo.apps.hmf.q7z3.p1.openshiftapps.com/hub/login',
    description: 'Jupyter Notebooks pro ... visualisations'
  },
// more data
]
<Grid hasGutter>
  {odhApps.map(a => <GridItem span={3}><OdhAppCard img={a.img} link={a.link} description={a.description}/></GridItem>)}
</Grid>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add className to components you want to style and put this css into a separate file and import it.

Always prefer external stylesheets over internal and inline. If you can't do that, you have to have a very good reason. Inline styles are very hard to override or maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very true that external styling should be given more priority than inline style sheet.

@@ -0,0 +1,43 @@
.gridItem{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no reason to make a separate file and include it multiple times throughout the application. Just put this in the index.scss and it will be available throughout. If you need to override you can override them in the component and with specificity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I didn't think at first that putting in the index.css will available throughout. It works! Perfect!

return (
<PageSection variant={PageSectionVariants.light}>
<Grid hasGutter className="gridItem">
{odhApps.map(a => <GridItem span={12} sm={12} md={6} lg={4} xl={3}><OdhAppCard img={a.img} link={a.link} description={a.description} buttonName={a.buttonName} altName={a.altName}/></GridItem>)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add key prop here. It's giving me a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, right - key not there will give warning in the web console. It will be created.

@cfchase cfchase merged commit 9614366 into opendatahub-io:master Jun 17, 2020
tumido referenced this pull request in tumido/odh-dashboard Jan 29, 2021
feat: Update Argo route to argo-server
accorvin pushed a commit to accorvin/odh-dashboard that referenced this pull request Apr 24, 2021
cam-garrison added a commit to cam-garrison/odh-dashboard that referenced this pull request May 30, 2023
…ndatahub-io#4)

* use project annotation for ds project nb routing

* chore: passes host instead of the entire route

and removes hub-url annotation as it is not needed

* remove reference to hub-host

---------

Co-authored-by: bartoszmajsak <bartosz.majsak@gmail.com>
cam-garrison added a commit to cam-garrison/odh-dashboard that referenced this pull request Jul 31, 2023
…ndatahub-io#4)

* use project annotation for ds project nb routing

* chore: passes host instead of the entire route

and removes hub-url annotation as it is not needed

* remove reference to hub-host

---------

Co-authored-by: bartoszmajsak <bartosz.majsak@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants