WIP: proof of concept for scrollable modals on mobile

pull/1255/head
hirusi 5 years ago
parent a5c481692d
commit 5790580add

@ -31,7 +31,7 @@
bottom: 0;
background: rgba(0,0,0,0.6);
z-index: 99;
overflow-x: hidden;
overflow-x: auto;
overflow-y: auto;
}

@ -60,7 +60,7 @@ class CountriesModal extends React.Component {
<div className="my-4 border-b border-gray-300 dark:border-gray-500"></div>
<main className="modal__content">
<table className="w-full table-striped table-fixed">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed">
<thead>
<tr>
<th

@ -102,7 +102,7 @@ class EntryPagesModal extends React.Component {
<div className="my-4 border-b border-gray-300"></div>
<main className="modal__content">
<table className="w-full table-striped table-fixed">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed">
<thead>
<tr>
<th

@ -80,7 +80,7 @@ class ExitPagesModal extends React.Component {
<div className="my-4 border-b border-gray-300"></div>
<main className="modal__content">
<table className="w-full table-striped table-fixed">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed">
<thead>
<tr>
<th className="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Page url</th>

@ -81,7 +81,7 @@ class GoogleKeywordsModal extends React.Component {
}
} else if (this.state.searchTerms.length > 0) {
return (
<table className="w-full table-striped table-fixed">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed">
<thead>
<tr>
<th className="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Search Term</th>

@ -42,12 +42,32 @@ class Modal extends React.Component {
this.props.history.push(`/${encodeURIComponent(this.props.site.domain)}${this.props.location.search}`)
}
/**
* @description
* Decide whether to set max-width, and if so, to what.
* If no max-width is available, set width instead to max-content.
*/
getStyle() {
const { maxWidth } = this.props;
const styleObject = {};
if (maxWidth) {
styleObject.maxWidth = maxWidth;
} else {
styleObject.width = "max-content";
}
return styleObject;
}
render() {
return createPortal(
<div className="modal is-open" onClick={this.props.onClick}>
<div className="modal__overlay">
<button className="modal__close"></button>
<div ref={this.node} className="modal__container dark:bg-gray-800" style={{maxWidth: this.props.maxWidth || '860px'}}>
<div
ref={this.node}
className="modal__container dark:bg-gray-800"
style={this.getStyle()}
>
{this.props.children}
</div>

@ -96,7 +96,7 @@ class PagesModal extends React.Component {
<div className="my-4 border-b border-gray-300"></div>
<main className="modal__content">
<table className="w-full table-striped table-fixed">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed">
<thead>
<tr>
<th className="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Page url</th>

@ -149,7 +149,7 @@ class ReferrerDrilldownModal extends React.Component {
<h1 className="text-xl font-semibold mb-0 leading-none dark:text-gray-200">{this.state.totalVisitors} visitors from {decodeURIComponent(this.props.match.params.referrer)}<br /> {toHuman(this.state.query)}</h1>
{this.renderGoalText()}
<table className="w-full table-striped table-fixed mt-4">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed mt-4">
<thead>
<tr>
<th className="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Referrer</th>

@ -126,7 +126,7 @@ class SourcesModal extends React.Component {
<div className="my-4 border-b border-gray-300 dark:border-gray-500"></div>
<main className="modal__content">
<table className="w-full table-striped table-fixed">
<table className="w-max overflow-x-auto md:w-full table-striped table-fixed">
<thead>
<tr>
<th className="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Source</th>

Loading…
Cancel
Save