Skip to content

Commit

Permalink
[PLAY-739] Rebuild Getting Started (#2475)
Browse files Browse the repository at this point in the history
<img width="1726" alt="Screenshot 2023-04-19 at 2 29 35 PM"
src="https://user-images.githubusercontent.com/8194056/233167385-e618aed1-bb3a-4a08-8ac3-087fb2559db0.png">


**How to test?** Steps to confirm the desired behavior:
Go to the `/getting_started` page, check its content. Click on all the
links available on the page and check the design and content.

#### Checklist:
- [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new
kit`, `deprecated`, or `breaking`. See [Changelog &
Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels)
for details.
- [x] **DEPLOY** I have added the `milano` label to show I'm ready for a
review.
- [ ] **TESTS** I have added test coverage to my code.

---------

Co-authored-by: Israel Molestina <[email protected]>
Co-authored-by: Nida Ghuman <[email protected]>
Co-authored-by: Carlos Lima <[email protected]>
Co-authored-by: Mark Rosenberg <[email protected]>
Co-authored-by: Jasper Furniss <[email protected]>
Co-authored-by: Jasper Furniss <[email protected]>
  • Loading branch information
7 people authored Apr 24, 2023
1 parent d795237 commit 187c21a
Show file tree
Hide file tree
Showing 16 changed files with 304 additions and 73 deletions.
19 changes: 19 additions & 0 deletions playbook-website/app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,27 @@ def enable_dark_mode
end

def getting_started
render "pages/getting_started/index"
end

def getting_started_rails
@rails_getting_started = Rails.root.join("app/views/pages/getting_started_partials/_rails_getting_started.md").read
render "pages/getting_started/rails"
end

def getting_started_react
@react_getting_started = Rails.root.join("app/views/pages/getting_started_partials/_react_getting_started.md").read
render "pages/getting_started/react"
end

def getting_started_rails_react
@rails_react_getting_started = Rails.root.join("app/views/pages/getting_started_partials/_rails_react_getting_started.md").read
render "pages/getting_started/rails_react"
end

def getting_started_html_css
@html_css_getting_started = Rails.root.join("app/views/pages/getting_started_partials/_html_css_getting_started.md").read
render "pages/getting_started/html"
end

def changelog
Expand Down
1 change: 1 addition & 0 deletions playbook-website/app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'playbook-ui/dist/playbook-rails'
import 'playbook-ui/dist/playbook-doc' // playbook-react doc components
import '@fortawesome/fontawesome-pro/js/fontawesome.min.js'
import '@fortawesome/fontawesome-pro/js/regular.min.js'
import '@fortawesome/fontawesome-pro/js/brands.min.js'

import '../site_styles/main.scss'

Expand Down
32 changes: 30 additions & 2 deletions playbook-website/app/javascript/site_styles/_getting_started.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@
.getting_started {
display: flex;
justify-content: center;
padding: $space_lg $space_xl;
padding: $space_lg 0;
[class^=pb_bread_crumbs_kit] {
border-color: $transparent;
}
[class^=pb_selectable_card] {
[class*=pb_icon_kit] {
color: $text_lt_lighter;
}
}
[class^=pb_bread_crumbs_kit] {
[class*=pb_icon_kit],
[class*=pb_title_kit_4] {
&:not(.current) {
color: $text_lt_light !important;
}
}
}
[class^=pb_selectable_card_icon_kit] {
label {
padding: $space_xl 0;
}
.pb_body_kit_light {
display: none;
}
}
.markdown {
code {
// override
Expand All @@ -15,5 +39,9 @@
border-radius: $border_rad_heavy;
}
}
img {
width: 100%;
height: auto;
}
}
}
}
3 changes: 3 additions & 0 deletions playbook-website/app/javascript/site_styles/_site-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ $nav_breakpoint: breakpoint("lg");
body {
overflow-x: hidden;
position: relative;
display: flex;
flex-direction: column;
&.visual_guidelines,
&.kits {
overflow-y: hidden;
Expand Down Expand Up @@ -157,6 +159,7 @@ body {
&--footer {
background-color: $royal;
padding: $space_lg * 2 $space_lg * 3;
margin-top: auto;
.inner-footer-wrapper {
max-width: 1350px;
margin: 0 auto;
Expand Down
8 changes: 0 additions & 8 deletions playbook-website/app/views/pages/getting_started.html.erb

This file was deleted.

22 changes: 22 additions & 0 deletions playbook-website/app/views/pages/getting_started/html.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%= pb_rails("flex", props:{ classname: "getting_started", justify: "center" }) do %>
<%= pb_rails("flex/flex_item", props:{ max_width: "md", classname: "markdown" }) do %>
<div>
<%= pb_rails("bread_crumbs", props: { aria: { label: "Breadcrumb Navigation" }, margin_bottom: "xl" }) do%>
<%= pb_rails("icon", props: { icon: "flag-checkered"}) %>
<%= pb_rails("bread_crumbs/bread_crumb_item", props: { link: "/getting_started" }) do %>
<%= pb_rails("title", props: { size: 4, text: "Getting Started", tag: "span" }) %>
<%end%>
<%= pb_rails("icon", props: { icon: "file-code", classname: "current" }) %>
<%= pb_rails("bread_crumbs/bread_crumb_item") do %>
<%= pb_rails("title", props: { size: 4, text: "HTML & CSS", tag: "span", classname: "current" }) %>
<%end%>
<%end%>
</div>
<%= pb_rails("title", props: { text: "HTML & CSS", tag: "h1", size: 1, margin_bottom: "sm" }) %>
<%= pb_rails("body", props: { margin_bottom: "md"}) do %>
If you have another environment like PHP you can still use Playbook through the raw CSS and using the copy
HTML button on and Rails kit. See details below:
<% end %>
<%= markdown(@html_css_getting_started) %>
<% end %>
<% end %>
58 changes: 58 additions & 0 deletions playbook-website/app/views/pages/getting_started/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<%= pb_rails("flex", props:{ classname: "getting_started", justify: "center" }) do %>
<%= pb_rails("flex/flex_item", props:{ max_width: "md"}) do %>
<%= pb_rails("title", props: { text: "Getting Started", tag: "h1", size: 1, margin_bottom: "sm" }) %>
<%= pb_rails("body", props: { margin_bottom: "md"}) do %>
Playbook is an open source design system built for Ruby on Rails, React, and very soon SwiftUI. Playbook is built
& maintained by the User Experience & Development teams at <a href="https://powerhrg.com/">Power Home Remodeling</a>. Playbook is packaged
up as a <a href="https://rubygems.org/gems/playbook_ui">RubyGem</a> and <a href="https://www.npmjs.com/package/playbook-ui">NPM Package</a> and can work with a variety of setups.
<% end %>
<%= pb_rails("section_separator", props: { margin_y: "lg" }) %>
<%= pb_rails("flex", props:{ justify: "center" }) do %>
<%= pb_rails("caption", props: { size: 'lg', margin_y: "lg" }) do %>
What type of setup do you have?
<% end %>
<% end %>
<%= pb_rails("flex", props:{ gap: "sm", wrap:true }) do %>
<%= pb_rails("flex/flex_item", props: {
flex: 1
}) do %>
<a href="/getting_started/rails">
<%= pb_rails("selectable_card_icon", props: {
icon: "gem",
title_text: "Ruby on Rails",
}) %>
</a>
<% end %>
<%= pb_rails("flex/flex_item", props: {
flex: 1
}) do %>
<a href="/getting_started/rails_react">
<%= pb_rails("selectable_card_icon", props: {
icon: "object-intersect",
title_text: "Rails & React",
}) %>
</a>
<% end %>
<%= pb_rails("flex/flex_item", props: {
flex: 1
}) do %>
<a href="/getting_started/react">
<%= pb_rails("selectable_card_icon", props: {
icon: "atom",
title_text: "React",
}) %>
</a>
<% end %>
<%= pb_rails("flex/flex_item", props: {
flex: 1
}) do %>
<a href="/getting_started/html" id="html-setup">
<%= pb_rails("selectable_card_icon", props: {
icon: "file-code",
title_text: "HTML & CSS",
}) %>
</a>
<% end %>
<% end %>
<% end %>
<% end %>
22 changes: 22 additions & 0 deletions playbook-website/app/views/pages/getting_started/rails.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%= pb_rails("flex", props:{ classname: "getting_started", justify: "center" }) do %>
<%= pb_rails("flex/flex_item", props:{ max_width: "md", classname: "markdown" }) do %>
<div>
<%= pb_rails("bread_crumbs", props: { aria: { label: "Breadcrumb Navigation" }, margin_bottom: "xl" }) do%>
<%= pb_rails("icon", props: { icon: "flag-checkered"}) %>
<%= pb_rails("bread_crumbs/bread_crumb_item", props: { link: "/getting_started" }) do %>
<%= pb_rails("title", props: { size: 4, text: "Getting Started", tag: "span" }) %>
<%end%>
<%= pb_rails("icon", props: { icon: "gem", classname: "current" }) %>
<%= pb_rails("bread_crumbs/bread_crumb_item") do %>
<%= pb_rails("title", props: { size: 4, text: "Ruby on Rails", tag: "span", classname: "current" }) %>
<%end%>
<%end%>
</div>
<%= pb_rails("title", props: { text: "Ruby on Rails Setup", tag: "h1", size: 1, margin_bottom: "sm" }) %>
<%= pb_rails("body", props: { margin_bottom: "md"}) do %>
Jumpstart your React app's UI development with Playbook's design system. Here's a few routes you can take
to get you started:
<% end %>
<%= markdown(@rails_getting_started) %>
<% end %>
<% end %>
22 changes: 22 additions & 0 deletions playbook-website/app/views/pages/getting_started/rails_react.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%= pb_rails("flex", props:{ classname: "getting_started", justify: "center" }) do %>
<%= pb_rails("flex/flex_item", props:{ max_width: "md", classname: "markdown" }) do %>
<div>
<%= pb_rails("bread_crumbs", props: { aria: { label: "Breadcrumb Navigation" }, margin_bottom: "xl" }) do%>
<%= pb_rails("icon", props: { icon: "flag-checkered"}) %>
<%= pb_rails("bread_crumbs/bread_crumb_item", props: { link: "/getting_started" }) do %>
<%= pb_rails("title", props: { size: 4, text: "Getting Started", tag: "span" }) %>
<%end%>
<%= pb_rails("icon", props: { icon: "object-intersect"}) %>
<%= pb_rails("bread_crumbs/bread_crumb_item") do %>
<%= pb_rails("title", props: { size: 4, text: "Rails & React Setup", tag: "span", classname: "current" }) %>
<%end%>
<%end%>
</div>
<%= pb_rails("title", props: { text: "Rails & React Setup", tag: "h1", size: 1, margin_bottom: "sm" }) %>
<%= pb_rails("body", props: { margin_bottom: "md"}) do %>
Integrate Playbook's design system seamlessly into your Rails and React app with the Playbook Ruby Gem and React components.
Get started today with our easy-to-follow tutorial.
<% end %>
<%= markdown(@rails_react_getting_started) %>
<% end %>
<% end %>
22 changes: 22 additions & 0 deletions playbook-website/app/views/pages/getting_started/react.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%= pb_rails("flex", props:{ classname: "getting_started", justify: "center" }) do %>
<%= pb_rails("flex/flex_item", props:{ max_width: "md", classname: "markdown" }) do %>
<div>
<%= pb_rails("bread_crumbs", props: { aria: { label: "Breadcrumb Navigation" }, margin_bottom: "xl" }) do%>
<%= pb_rails("icon", props: { icon: "flag-checkered"}) %>
<%= pb_rails("bread_crumbs/bread_crumb_item", props: { link: "/getting_started" }) do %>
<%= pb_rails("title", props: { size: 4, text: "Getting Started", tag: "span" }) %>
<%end%>
<%= pb_rails("icon", props: { icon: "atom", classname: "current" }) %>
<%= pb_rails("bread_crumbs/bread_crumb_item") do %>
<%= pb_rails("title", props: { size: 4, text: "React", tag: "span", classname: "current" }) %>
<%end%>
<%end%>
</div>
<%= pb_rails("title", props: { text: "React Setup", tag: "h1", size: 1, margin_bottom: "sm" }) %>
<%= pb_rails("body", props: { margin_bottom: "md"}) do %>
Playbook's Ruby Gem makes it easy to use playbook with your favorite rails app. Here's a few routes you can take
to get you started:
<% end %>
<%= markdown(@react_getting_started) %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#### Add the Playbook NPM Package

```sh
yarn add "playbook-ui@stable"
```

This will allow you to choose what version you want.

```sh
yarn install
```

#### Import the CSS

```sass
@import "playbook-ui/dis/playbook";
@import "playbook-ui/dist/reset";
```

#### Optionally you can import the Javascript if you want some of the interactivity
This will add all the Javascript to use the popovers & graphs for example.

```js
import 'playbook-ui/dist/playbook-rails.js';
```

#### Navigate to the Rails Kits and copy the raw HTML from the examples

![Copy the raw HTML from the examples](/images/getting_started/copy_html.png)

#### How to include CSS and Javascript Assets
To include CSS and JavaScript files in an HTML document, follow these steps:
1. Create a CSS file with the extension ".css" and a JavaScript file with the extension ".js". Place them in a directory on your server, preferably in a subdirectory named "css" or "js" respectively.
2. Open the HTML file you want to add the assets to in a text editor.
3. To include a CSS file in the HTML document, add the following code to the "head" section of the HTML document:

```html
<link rel="stylesheet" type="text/css" href="path/to/your/css/file.css">
```

Replace "path/to/your/css/file.css" with the actual path to your CSS file.
4. To include a JavaScript file in the HTML document, add the following code to the "head" section of the HTML document:

```html
<script src="path/to/your/js/file.js"></script>
```

Replace "path/to/your/js/file.js" with the actual path to your JavaScript file.
5. Save the HTML file and upload all the files (HTML, CSS, and JavaScript) to your server.
6. Test your HTML document in a web browser to ensure that the assets are being loaded correctly.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Rails Getting Started (with Webpacker)

#### Update your Gemfile
```sh
gem 'playbook_ui'
Expand Down Expand Up @@ -37,49 +35,4 @@ or be selective
@import "pb_body/body";
```

From here all of our display kits should work for you nicely


## Javascript Enabled Rails Kits
To use kits with interactivity, and our graphs you need to bring in the NPM package.

#### Add the Playbook NPM Package
```sh
yarn add "playbook-ui@stable"
```

This will allow you to choose what version you want.

```sh
yarn install
```

Now that you have the package installed you could import styles via JS

```jsx
@import "playbook-ui/dist/tokens/screen_sizes.scss";
```


#### Import all the Javascript Needed for Rails Kits

This will add all the javascript to use the popovers, & graphs for example.

```js
import 'playbook-ui/dist/playbook-rails.js';
```

#### Add Inline Rails JS to Your Layout (Needed for Rails Graphs)

```erb
<%%= yield :pb_js %>
```

#### Add Font Awesome

Playbook ships with font awesome but you’ll need to include it in your application

```js
//= require regular-min.js
//= require fontawesome-min.js
```
From here all of our display kits should work for you nicely
Loading

0 comments on commit 187c21a

Please sign in to comment.