Skip to content

Commit

Permalink
Improve grid view responsive CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyReichert committed Feb 28, 2024
1 parent 0e6ecad commit b8eefa1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 13 deletions.
42 changes: 36 additions & 6 deletions src/assets/css/simply-rets-client.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,25 @@ sizes with this class.
display: block;
}

#sr-listings-results-list {
clear: both;
}

.sr-listing-grid-item {
width: 32%;
display: inline-block;
margin: auto;
margin-top: 25px;
padding: 10px 0 10px 0;
vertical-align: top;
}

.sr-listings-grid-view {
display: grid;
justify-content: center;
grid-template-columns: repeat(3, 1fr);
column-gap: 15px;
}

.sr-pagination-wrapper {
clear: both;
padding-top: 15px;
padding-bottom: 15px;
}


Expand Down Expand Up @@ -251,7 +263,10 @@ styling:

.sr-listing-grid-item .result-compliance-markup {
display: block;
font-size: 12px;
}

.result-compliance-markup {
font-size: 90%;
}


Expand Down Expand Up @@ -565,6 +580,7 @@ Most of these elements also have id's for you to use specifically.
padding: 0px;
padding-top: 0px;
padding-bottom: 15px;
margin-bottom: 25px;
}

#sr-search-wrapper form {
Expand Down Expand Up @@ -847,8 +863,22 @@ elsewhere, this should be a breeze.
/*
* Responsive CSS
*/

@media screen and (max-width: 768px) {

.sr-listings-grid-view {
grid-template-columns: repeat(2, 1fr);
column-gap: 10px;
}
}

@media screen and (max-width: 576px) {

/* Grid view results */
.sr-listings-grid-view {
grid-template-columns: 100%;
}

/*
* Search results
*/
Expand Down
15 changes: 10 additions & 5 deletions src/simply-rets-api-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ public static function srResidentialResultsGenerator($request_response, $setting
$grid_view = $settings['grid_view'] == TRUE;

/** Allow override of "map_position" admin setting on a per short-code basis */
$map_setting = isset($settings['show_map']) ? $settings['show_map'] : '';
$map_setting = isset($settings['show_map']) ? $settings['show_map'] : true;
$map_position = isset($settings['map_position'])
? $settings['map_position']
: get_option('sr_search_map_position', 'map_above');
Expand Down Expand Up @@ -1700,10 +1700,13 @@ public static function srResidentialResultsGenerator($request_response, $setting

}

$resultsMarkup = "<div id=\"sr-listings-results-list\">{$resultsMarkup}</div>";
$markupGridViewClass = $grid_view == true ? "sr-listings-grid-view" : "";
$resultsMarkup = "<div id='sr-listings-results-list' class='{$markupGridViewClass}'>"
. "{$resultsMarkup}"
. "</div>";
$markerCount > 0 ? $mapMarkup = $mapHelper->render($map) : $mapMarkup = '';

if( $map_setting == 'false' ) {
if( $map_setting === "false" ) {
$mapMarkup = '';
}

Expand Down Expand Up @@ -1733,8 +1736,10 @@ public static function srResidentialResultsGenerator($request_response, $setting

$disclaimer_text = SrUtils::mkDisclaimerText($lastUpdate);

$cont .= "<hr><p class='sr-pagination'>$prev_link $next_link</p>";
$cont .= "<br>{$disclaimer_text}";
$cont .= "<div class='sr-pagination-wrapper'>"
. " <p class='sr-pagination'>$prev_link $next_link</p>"
. " <div class='sr-disclaimer-text'>{$disclaimer_text}</div>"
. "</div>";

return $cont;

Expand Down
3 changes: 1 addition & 2 deletions src/simply-rets-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ public static function sr_openhouses_shortcode($atts = array()) {
public static function sr_residential_shortcode($atts = array ()) {
$setting_atts = array(
"map_position" => get_option('sr_search_map_position', 'map_above'),
"show_map" => "true",
"grid_view" => false,
"vendor" => "",
"limit" => 20
Expand Down Expand Up @@ -344,7 +343,7 @@ public static function sr_search_form_shortcode( $atts ) {

/** Settings */
$grid_view = isset($atts["grid_view"]) ? $atts["grid_view"] : FALSE;
$show_map = isset($atts["show_map"]) ? $atts["show_map"] : TRUE;
$show_map = isset($atts["show_map"]) ? $atts["show_map"] : "true";

/** User Facing Parameters */
$minbeds = array_key_exists('minbeds', $atts) ? $atts['minbeds'] : '';
Expand Down

0 comments on commit b8eefa1

Please sign in to comment.