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

[PLAY-1500] Home Address Street: "none" Emphasis Prop #4006

Merged
merged 7 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type HomeAddressStreetProps = {
className?: string,
data?: { [key: string]: string },
dark?: boolean,
emphasis: "street" | "city",
emphasis: "street" | "city" | "none",
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
homeId: string,
houseStyle: string,
Expand Down Expand Up @@ -129,6 +129,22 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
</div>
</div>
}
{emphasis == 'none' &&
<div>
<Body dark={dark}>
{joinPresent([titleize(address), houseStyle], ' · ')}
</Body>
<Body dark={dark}>{titleize(addressCont)}</Body>
<div>
<Body
color="light"
dark={dark}
>
{`${titleize(city)}, ${state} ${zipcode}`}
</Body>
</div>
</div>
}
{homeId &&
<Hashtag
classname="home-hashtag"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,20 @@
state: "PA",
zipcode: "19382",
territory: "PHL",
}) %>
}) %>

<br>
<br>

<%= pb_rails("home_address_street", props: {
address: "70 Prospect Ave",
address_cont: "Apt M18",
city: "West Chester",
emphasis: "none",
home_id: 8250263,
home_url: "https://powerhrg.com/",
house_style: "Colonial",
state: "PA",
zipcode: "19382",
territory: "PHL",
}) %>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ const HomeAddressStreetEmphasis = (props) => {
zipcode="19382"
{...props}
/>
<br />
<br />
<HomeAddressStreet
address="70 Prospect Ave"
addressCont="Apt M18"
city="West Chester"
emphasis="none"
homeId="8250263"
homeUrl="https://powerhrg.com/"
houseStyle="Colonial"
state="PA"
territory="PHL"
zipcode="19382"
{...props}
/>
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Emphasis on street happens by default. (no prop needed)
Emphasis on "city" makes the city emphasized, rather than the street.
Emphasis on "city" makes the city emphasized, rather than the street.
Adding "none" to emphasis prop will provide no emphasis.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class HomeAddressStreet < Playbook::KitBase
prop :address_cont
prop :city
prop :emphasis, type: Playbook::Props::Enum,
values: %w[street city],
values: %w[street city none],
default: "street"
prop :home_id, type: Playbook::Props::Number
prop :home_url
Expand Down Expand Up @@ -77,6 +77,20 @@ def street_emphasis_props
}
end

def none_emphasis_props
{
address_house_style: address_house_style,
address_house_style2: address_house_style2,
city_state_zip: city_state_zip,
dark: dark,
home_id: home_id,
home_url: home_url,
target: target_option,
new_window: new_window,
territory: territory,
}
end

def target_option
if target && home_url
target
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<%= pb_rails "body", props: {
classname: "pb_home_address_street_address",
size: 4,
text: object.address_house_style,
dark: object.dark
} %>
<%= pb_rails "body", props: {
classname: "pb_home_address_street_address",
size: 4,
text: object.address_house_style2,
dark: object.dark
} %>
<%= pb_rails "body", props: {
color: "light",
text: object.city_state_zip,
dark: object.dark
} %>

<% if object.home_id %>
<%= pb_rails("hashtag", props: {
text: "#{object.home_id}",
url: object.home_url || "#",
type: "home",
dark: object.dark,
classname: "home-hashtag",
new_window: object.new_window,
target: object.target_option}) %>
<% end %>

<%= pb_rails "body", props: { color: "light", tag: "span", dark: object.dark } do %>
<small><%= object.territory %></small>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module Playbook
module PbHomeAddressStreet
class NoneEmphasis < Playbook::KitBase
prop :address_house_style
prop :address_house_style2
prop :city_state_zip
prop :home_id, type: Playbook::Props::Number
prop :home_url
prop :new_window, type: Playbook::Props::Boolean,
default: false
prop :target
prop :territory
prop :dark, type: Playbook::Props::Boolean,
default: false

def target_option
if target && home_url
target
elsif new_window
"_blank"
else
"_self"
end
end
end
end
end
Loading