-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow Responsive Display Global Props #1846
Merged
thestephenmarshall
merged 26 commits into
master
from
PLAY-33-Global-responsive-display-props-in-all-kits
May 12, 2022
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5141d75
Added conditional to displayProps
diontheroulde 52d0e84
Added breakpoint query
diontheroulde 86e4968
Removed commented out code
diontheroulde d369c00
Trying to display gloabl props
diontheroulde 3cccb64
Display global props
thestephenmarshall a2d1baf
Display breakpoints on rails
diontheroulde 9cd88e9
Merge branch 'master' of github.com:powerhome/playbook into PLAY-33-G…
diontheroulde ee8d7e8
Merge branch 'master' of github.com:powerhome/playbook into PLAY-33-G…
diontheroulde a023541
Working on multiple screen sizes
diontheroulde 5d6daac
Display global props at multiple screen sizes
diontheroulde ad84e31
Added Props pill back for display
diontheroulde 045d377
Separate base types
thestephenmarshall 1832dcd
Fix display.rb css output
thestephenmarshall bf64dd8
Merge branch 'master' of github.com:powerhome/playbook into PLAY-33-G…
diontheroulde 43f25fb
Diplay working for both rails and react
diontheroulde 1c66bb5
Global props work fro single display value
diontheroulde f8656fb
Edited visual guidelines styling
diontheroulde 3d25b08
Fixed syntax for display.ts
diontheroulde 9f59d1a
Switched display.ts syntax back
diontheroulde 359811f
Fixed syntax error this time
diontheroulde 90edcdc
Merge remote-tracking branch 'origin/master' into PLAY-33-Global-resp…
thestephenmarshall e477fac
Fix types and SCSS classes
thestephenmarshall 8b1037c
Add breakpoints grid to screen sizes
thestephenmarshall 8f56759
Don't make changes to unassociated files
thestephenmarshall 373783c
All files should have one empty line at the end per code style rules
thestephenmarshall 56eeda4
Add colors type
thestephenmarshall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 14 additions & 3 deletions
17
playbook-website/app/views/pages/code_snippets/display_in_use_jsx.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
<Button display="flex"> | ||
Button Text | ||
<Button/> | ||
<Card display="flex"> | ||
Card content | ||
<Card/> | ||
|
||
<Card | ||
display={ | ||
xs: "hidden", | ||
sm: "flex", | ||
md: "inline", | ||
lg: "inline_block", | ||
xl: "block" | ||
} | ||
> | ||
Card content | ||
<Card/> |
59 changes: 33 additions & 26 deletions
59
playbook-website/app/views/pages/visual_guidelines_partials/_display.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
<%= pb_rails("title", props: { text: "Display", size: 1, margin_top: "xl", padding_top: "xl" }) %> | ||
<%= pb_rails("body", props: { tag: "p", margin_top: "xs", margin_bottom: "lg" }) do %> | ||
<% end %> | ||
<%= pb_rails("title", props: { text: "Global Props", tag: "h3", size: 4, margin_bottom: "xs" }) %> | ||
<%= pb_rails("body", props: { text: "Available in every kit. These are added globally as they are most flexible when developing.", margin_bottom: "sm" }) %> | ||
<%= pb_rails("title", props: { text: "Display", size: 1, margin_bottom: "sm", margin_top: "xl", padding_top: "xl" }) %> | ||
<%= pb_rails("title", props: { text: "Global Props", tag: "h3", size: 4, margin_bottom: "xs" }) %> | ||
<%= pb_rails("body", props: { text: "Available in every kit. These are added globally as they are most flexible when developing.", margin_bottom: "sm", margin_top: "xs" }) %> | ||
<%= pb_rails("card", props: { shadow: "deep", margin_bottom: "sm", padding: "none" }) do %> | ||
<%= pb_rails("flex", props: { vertical: "stretch", padding_x: "md", padding_top: "md", padding_bottom: "md" }) do %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: "Props", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "display", variant: "neutral" }) %> | ||
<% end %> | ||
<%= pb_rails("section_separator", props: { orientation: "vertical", margin_x: "sm" }) %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: "Values", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline_block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "flex", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline_flex", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "hidden", variant: "warning" }) %> | ||
<% end %> | ||
<%= pb_rails("flex", props: { vertical: "stretch", padding_x: "md", padding_top: "md", padding_bottom: "md" }) do %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1"}) do %> | ||
<%= pb_rails("caption", props: { text: "Props", margin_bottom: "sm" })%> | ||
<%= pb_rails("pill", props: { text: "Display", variant: "neutral"})%> | ||
<% end %> | ||
<%= pb_rails("section_separator", props: { orientation: "vertical", margin_x: "sm" }) %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: " Screen Sizes", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "xs", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "sm", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "md", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "lg", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "xl", variant: "warning" }) %> | ||
<% end %> | ||
<%= pb_rails("background", props: { id: "code-wrapper", classname: "border-bottom", background_color: "dark", padding: "none" }) do %> | ||
<%= pb_rails("caption", props: { text: "EXAMPLE IN USE", padding_top: "lg", margin_x: "xl", classname: "dark" }) %> | ||
<div class="pb--codeCopy"> | ||
<pre class="highlight pt_sm" style="margin: 0px"><%= raw rouge(@display_in_use_code_example, "react") %></pre> | ||
</div> | ||
<%= pb_rails("section_separator", props: { orientation: "vertical", margin_x: "sm" }) %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: "Values", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "inline", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "flex", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline_block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "hidden", variant: "warning" }) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= pb_rails("background", props: { id: "code-wrapper", classname: "border-bottom", background_color: "dark", padding: "none" }) do %> | ||
<%= pb_rails("caption", props: { text: "EXAMPLE IN USE", padding_top: "lg", margin_x: "xl", classname: "dark" }) %> | ||
<div class="pb--codeCopy"> | ||
<pre class="highlight pt_sm" style="margin: 0px"><%= raw rouge(@display_in_use_code_example, "react") %></pre> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<%= render "pages/visual_guidelines_partials/display_breakpoints"%> |
51 changes: 51 additions & 0 deletions
51
playbook-website/app/views/pages/visual_guidelines_partials/_display_breakpoints.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<%= pb_rails("title", props: { text: "Utility Classes", tag: "h3", size: 4, margin_bottom: "xs", padding_top: "xs" }) %> | ||
<%= pb_rails("body", props: { text: "Just want the raw classes? We got you. All of our global props are simple CSS utilities available through classes.", margin_bottom: "sm" }) %> | ||
<%= pb_rails("caption", props: { text: "Visual Guide", margin_bottom: "sm" }) %> | ||
<%= pb_rails("card", props: { | ||
margin_bottom: "none", | ||
padding: "none", | ||
shadow: "deep" | ||
}) do %> | ||
<%= pb_rails("table", props: { size: "sm" }) do %> | ||
<thead> | ||
<tr> | ||
<th>Screen Size</th> | ||
<th>@media screen</th> | ||
<th>Class</th> | ||
<th>Properties</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>xs</td> | ||
<td>@media screen and (max-width: 575px)</td> | ||
<td>.display_xs_hidden</td> | ||
<td>display: hidden !important</td> | ||
</tr> | ||
<tr> | ||
<td>sm</td> | ||
<td>@media screen and (max-width: 576px)</td> | ||
<td>.display_sm_block</td> | ||
<td>display: block !important</td> | ||
</tr> | ||
<tr> | ||
<td>md</td> | ||
<td>@media screen and (max-width: 768px)</td> | ||
<td>.display_md_inline_block</td> | ||
<td>display: inline-block !important</td> | ||
</tr> | ||
<tr> | ||
<td>lg</td> | ||
<td>@media screen and (max-width: 992px)</td> | ||
<td>.display_lg_inline</td> | ||
<td>display: inline !important</td> | ||
</tr> | ||
<tr> | ||
<td>xl</td> | ||
<td>@media screen and (max-width: 1200px)</td> | ||
<td>.display_xl_flex</td> | ||
<td>display: flex !important</td> | ||
</tr> | ||
</tbody> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$display_inline: inline; | ||
$display_block: block; | ||
$display_inline_block: inline-block; | ||
$display_flex: flex; | ||
$display_none: none; | ||
$display_inline_flex: inline-flex; | ||
$displays: ( | ||
display_none: $display_none, | ||
display_flex: $display_flex, | ||
display_inline: $display_inline, | ||
display_inline_block: $display_inline_block, | ||
display_block: $display_block | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,26 @@ $breakpoints: ( | |
xl: $screen-xl-min | ||
); | ||
|
||
$breakpoints_grid: ( | ||
xs: ( | ||
max: $screen-xs-min | ||
), | ||
sm: ( | ||
min: $screen-sm-min, | ||
max: $screen-md-max | ||
), | ||
md: ( | ||
min: $screen-md-min, | ||
max: $screen-lg-max | ||
), | ||
lg: ( | ||
min: $screen-lg-min, | ||
max: $screen-xl-max | ||
), | ||
xl: ( | ||
min: $screen-xl-min, | ||
) | ||
); | ||
|
||
@function breakpoint($breakpoint_name) { | ||
@return map-get($breakpoints, $breakpoint_name); | ||
|
@@ -28,3 +48,19 @@ $breakpoints: ( | |
@content; | ||
} | ||
} | ||
|
||
@mixin break_on($min: null, $max: null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mixin will create a breakpoint grid with min and max sizes. This is the only way we could get the CSS declarations to apply. |
||
@if not $max { | ||
@media screen and (min-width: $min) { | ||
@content; | ||
} | ||
} @else if not $min { | ||
@media screen and (max-width: $max) { | ||
@content; | ||
} | ||
} @else { | ||
@media screen and (min-width: $min) and (max-width: $max) { | ||
@content; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Simple base types | ||
import { SyntheticEvent } from "react" | ||
|
||
export type Binary = 0 | 1 | ||
export type Callback<T, K> = (arg: T) => K | ||
export type EmptyObject = Record<string, unknown> | ||
export type InputCallback<T> = Callback<SyntheticEvent<T>, void> | ||
export type Noop = () => void |
5 changes: 0 additions & 5 deletions
5
playbook/app/pb_kits/playbook/types.ts → ...book/app/pb_kits/playbook/types/colors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
import { SyntheticEvent } from "react" | ||
|
||
export type Callback<T, K> = (arg: T) => K | ||
export type InputCallback<T> = Callback<SyntheticEvent<T>, void> | ||
|
||
export type BackgroundColors = "white" | "dark" | "light" | ||
export type CategoryColors = "category_1" | "category_2" | "category_3" | "category_4" | "category_5" | "category_6" | "category_7" | "category_8" | "category_9" | "category_10" | "category_11" | "category_12" | "category_13" | "category_14" | "category_15" | "category_16" | "category_17" | "category_18" | "category_19" | "category_20" | "category_21" | ||
export type ProductColors = "windows" | "siding" | "doors" | "solar" | "roofing" | "gutters" | "insulation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type DisplayType = "none" | "flex" | "inline_flex" | "inline" | "inline_block" | "block" | ||
|
||
export type Display = { | ||
display?: DisplayType, | ||
} | DisplaySizes | ||
|
||
export type DisplaySizes = {[key: string]: DisplayType | any} | ||
|
||
export type None = "none" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './base' | ||
export * from './colors' | ||
export * from './display' | ||
export * from './sizes' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Sizes = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relates to the
break_on
mixin