mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-22 22:24:00 +01:00
createnewmodal: change ux
This commit is contained in:
parent
1b00f87002
commit
1e71020d0b
@ -2,9 +2,9 @@ import { h, Component } from 'preact';
|
||||
import Modal from './Modal';
|
||||
import { ItemTile } from './ItemTile';
|
||||
import templates from '../templateList';
|
||||
import { Divider } from './common';
|
||||
import Switch from './Switch';
|
||||
import { BetaTag } from './common';
|
||||
import { trackEvent } from '../analytics';
|
||||
import Tabs, { TabPanel } from './Tabs';
|
||||
|
||||
export class CreateNewModal extends Component {
|
||||
constructor(props) {
|
||||
@ -30,197 +30,190 @@ export class CreateNewModal extends Component {
|
||||
onImportGithubRepoSelect,
|
||||
onTemplateSelect
|
||||
} = this.props;
|
||||
const option1 = (
|
||||
<div style="flex:1;" class="tac">
|
||||
<svg
|
||||
width="287px"
|
||||
height="80px"
|
||||
viewBox="0 0 287 197"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
style={`opacity:${!this.state.isFileModeSelected ? '1' : '0.4'}`}
|
||||
onClick={() => {
|
||||
this.setState({ isFileModeSelected: false });
|
||||
}}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<g
|
||||
id="Page-1"
|
||||
stroke="none"
|
||||
stroke-width="1"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
>
|
||||
<g id="codepane" fill="#C5C5C5">
|
||||
<rect id="Rectangle" x="0" y="0" width="89" height="80" rx="5" />
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(99.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect id="Rectangle" x="0" y="0" width="89" height="80" rx="5" />
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(198.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect id="Rectangle" x="0" y="0" width="89" height="80" rx="5" />
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(0.000000, 88.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="287"
|
||||
height="109"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<p class="mb-0">
|
||||
3 separate panes to write HTML, CSS and JavaScript. Good for quickly
|
||||
testing something.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
const option2 = (
|
||||
<div style="flex:1" class="tac ml-2">
|
||||
<svg
|
||||
width="286px"
|
||||
height="80px"
|
||||
viewBox="0 0 286 196"
|
||||
version="1.1"
|
||||
style={`opacity:${this.state.isFileModeSelected ? '1' : '0.4'}`}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
onClick={() => {
|
||||
this.setState({ isFileModeSelected: true });
|
||||
}}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<g
|
||||
id="Page-1"
|
||||
stroke="none"
|
||||
stroke-width="1"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
>
|
||||
<path
|
||||
d="M5,0 L49,0 C51.7614237,-5.07265313e-16 54,2.23857625 54,5 L54,191 C54,193.761424 51.7614237,196 49,196 L5,196 C2.23857625,196 1.62803173e-14,193.761424 0,191 L0,5 C-3.38176876e-16,2.23857625 2.23857625,5.07265313e-16 5,0 Z M7.59574468,29 C5.93889043,29 4.59574468,30.3431458 4.59574468,32 C4.59574468,33.6568542 5.93889043,35 7.59574468,35 L39.5106383,35 C41.1674925,35 42.5106383,33.6568542 42.5106383,32 C42.5106383,30.3431458 41.1674925,29 39.5106383,29 L7.59574468,29 Z M7.59574468,71 C5.93889043,71 4.59574468,72.3431458 4.59574468,74 C4.59574468,75.6568542 5.93889043,77 7.59574468,77 L24.5744681,77 C26.2313223,77 27.5744681,75.6568542 27.5744681,74 C27.5744681,72.3431458 26.2313223,71 24.5744681,71 L7.59574468,71 Z M14.4893617,84 C12.8325075,84 11.4893617,85.3431458 11.4893617,87 C11.4893617,88.6568542 12.8325075,90 14.4893617,90 L32.6170213,90 C34.2738755,90 35.6170213,88.6568542 35.6170213,87 C35.6170213,85.3431458 34.2738755,84 32.6170213,84 L14.4893617,84 Z M7.59574468,15 C5.93889043,15 4.59574468,16.3431458 4.59574468,18 C4.59574468,19.6568542 5.93889043,21 7.59574468,21 L32.6170213,21 C34.2738755,21 35.6170213,19.6568542 35.6170213,18 C35.6170213,16.3431458 34.2738755,15 32.6170213,15 L7.59574468,15 Z M13.3404255,42 C11.6835713,42 10.3404255,43.3431458 10.3404255,45 C10.3404255,46.6568542 11.6835713,48 13.3404255,48 L44.106383,48 C45.7632372,48 47.106383,46.6568542 47.106383,45 C47.106383,43.3431458 45.7632372,42 44.106383,42 L13.3404255,42 Z M14.4893617,57 C12.8325075,57 11.4893617,58.3431458 11.4893617,60 C11.4893617,61.6568542 12.8325075,63 14.4893617,63 L45.2553191,63 C46.9121734,63 48.2553191,61.6568542 48.2553191,60 C48.2553191,58.3431458 46.9121734,57 45.2553191,57 L14.4893617,57 Z"
|
||||
id="Combined-Shape"
|
||||
fill="#C5C5C5"
|
||||
/>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(64.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="106"
|
||||
height="196"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(180.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="106"
|
||||
height="196"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<p class="mb-0">
|
||||
Manage your code in files. Just like you would have files on your
|
||||
local machine. <BetaTag />
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal show={show} closeHandler={closeHandler}>
|
||||
<h1 class="mt-0">Create New</h1>
|
||||
<div class="flex">
|
||||
<div style="flex:1;" class="tac">
|
||||
<svg
|
||||
width="287px"
|
||||
height="80px"
|
||||
viewBox="0 0 287 197"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
style={`opacity:${!this.state.isFileModeSelected ? '1' : '0.4'}`}
|
||||
onClick={() => {
|
||||
this.setState({ isFileModeSelected: false });
|
||||
}}
|
||||
>
|
||||
<g
|
||||
id="Page-1"
|
||||
stroke="none"
|
||||
stroke-width="1"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
<Tabs horizontal>
|
||||
<TabPanel label={option1}>
|
||||
<div class="d-f fxw-w">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn--primary"
|
||||
style="margin:20px 10px"
|
||||
onClick={() => {
|
||||
trackEvent('ui', 'startBlankBtnClick');
|
||||
onBlankTemplateSelect();
|
||||
}}
|
||||
>
|
||||
<g id="codepane" fill="#C5C5C5">
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="89"
|
||||
height="80"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(99.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="89"
|
||||
height="80"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(198.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="89"
|
||||
height="80"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(0.000000, 88.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="287"
|
||||
height="109"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<p>
|
||||
3 separate panes to write HTML, CSS and JavaScript. Good for
|
||||
quickly testing something.
|
||||
</p>
|
||||
</div>
|
||||
<div class="tac ml-2" style="margin-top:100px;">
|
||||
<Switch
|
||||
checked={this.state.isFileModeSelected}
|
||||
labels={['3 panes', 'Files (beta)']}
|
||||
onChange={this.modeChangeHandler}
|
||||
showBothLabels
|
||||
/>
|
||||
</div>
|
||||
<div style="flex:1" class="tac ml-2">
|
||||
<svg
|
||||
width="286px"
|
||||
height="80px"
|
||||
viewBox="0 0 286 196"
|
||||
version="1.1"
|
||||
style={`opacity:${this.state.isFileModeSelected ? '1' : '0.4'}`}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
onClick={() => {
|
||||
this.setState({ isFileModeSelected: true });
|
||||
}}
|
||||
>
|
||||
<g
|
||||
id="Page-1"
|
||||
stroke="none"
|
||||
stroke-width="1"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
>
|
||||
<path
|
||||
d="M5,0 L49,0 C51.7614237,-5.07265313e-16 54,2.23857625 54,5 L54,191 C54,193.761424 51.7614237,196 49,196 L5,196 C2.23857625,196 1.62803173e-14,193.761424 0,191 L0,5 C-3.38176876e-16,2.23857625 2.23857625,5.07265313e-16 5,0 Z M7.59574468,29 C5.93889043,29 4.59574468,30.3431458 4.59574468,32 C4.59574468,33.6568542 5.93889043,35 7.59574468,35 L39.5106383,35 C41.1674925,35 42.5106383,33.6568542 42.5106383,32 C42.5106383,30.3431458 41.1674925,29 39.5106383,29 L7.59574468,29 Z M7.59574468,71 C5.93889043,71 4.59574468,72.3431458 4.59574468,74 C4.59574468,75.6568542 5.93889043,77 7.59574468,77 L24.5744681,77 C26.2313223,77 27.5744681,75.6568542 27.5744681,74 C27.5744681,72.3431458 26.2313223,71 24.5744681,71 L7.59574468,71 Z M14.4893617,84 C12.8325075,84 11.4893617,85.3431458 11.4893617,87 C11.4893617,88.6568542 12.8325075,90 14.4893617,90 L32.6170213,90 C34.2738755,90 35.6170213,88.6568542 35.6170213,87 C35.6170213,85.3431458 34.2738755,84 32.6170213,84 L14.4893617,84 Z M7.59574468,15 C5.93889043,15 4.59574468,16.3431458 4.59574468,18 C4.59574468,19.6568542 5.93889043,21 7.59574468,21 L32.6170213,21 C34.2738755,21 35.6170213,19.6568542 35.6170213,18 C35.6170213,16.3431458 34.2738755,15 32.6170213,15 L7.59574468,15 Z M13.3404255,42 C11.6835713,42 10.3404255,43.3431458 10.3404255,45 C10.3404255,46.6568542 11.6835713,48 13.3404255,48 L44.106383,48 C45.7632372,48 47.106383,46.6568542 47.106383,45 C47.106383,43.3431458 45.7632372,42 44.106383,42 L13.3404255,42 Z M14.4893617,57 C12.8325075,57 11.4893617,58.3431458 11.4893617,60 C11.4893617,61.6568542 12.8325075,63 14.4893617,63 L45.2553191,63 C46.9121734,63 48.2553191,61.6568542 48.2553191,60 C48.2553191,58.3431458 46.9121734,57 45.2553191,57 L14.4893617,57 Z"
|
||||
id="Combined-Shape"
|
||||
fill="#C5C5C5"
|
||||
/>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(64.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="106"
|
||||
height="196"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
id="codepane"
|
||||
transform="translate(180.000000, 0.000000)"
|
||||
fill="#C5C5C5"
|
||||
>
|
||||
<rect
|
||||
id="Rectangle"
|
||||
x="0"
|
||||
y="0"
|
||||
width="106"
|
||||
height="196"
|
||||
rx="5"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<p>
|
||||
Manage your code in files. Just like you would have files on your
|
||||
local machine.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Divider />
|
||||
|
||||
<div class="tac">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn--primary"
|
||||
onClick={() => {
|
||||
trackEvent('ui', 'startBlankBtnClick');
|
||||
this.state.isFileModeSelected
|
||||
? onBlankFileTemplateSelect()
|
||||
: onBlankTemplateSelect();
|
||||
}}
|
||||
>
|
||||
Start Blank
|
||||
</button>
|
||||
<p>Or choose from a template:</p>
|
||||
<div class="saved-items-pane__container">
|
||||
{templates.map(template => {
|
||||
if (
|
||||
!this.state.isFileModeSelected ||
|
||||
template.isFileModeSupported
|
||||
) {
|
||||
Start Blank
|
||||
</button>
|
||||
{templates.map(template => {
|
||||
return (
|
||||
<ItemTile
|
||||
inline
|
||||
item={template}
|
||||
focusable
|
||||
onClick={onTemplateSelect.bind(
|
||||
null,
|
||||
template,
|
||||
this.state.isFileModeSelected
|
||||
)}
|
||||
onClick={onTemplateSelect.bind(null, template)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tac">
|
||||
})}
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel label={option2}>
|
||||
<div class="d-f fxw-w">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn--primary"
|
||||
style="margin:20px 10px"
|
||||
onClick={() => {
|
||||
trackEvent('ui', 'startBlankFileBtnClick');
|
||||
onBlankFileTemplateSelect();
|
||||
}}
|
||||
>
|
||||
Start Blank in File Mode
|
||||
</button>
|
||||
{templates.map(template => {
|
||||
if (template.isFileModeSupported) {
|
||||
return (
|
||||
<ItemTile
|
||||
inline
|
||||
item={template}
|
||||
focusable
|
||||
onClick={onTemplateSelect.bind(null, template, true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
{/*<div class="tac">
|
||||
<p>
|
||||
{/*<button
|
||||
<button
|
||||
className="btn"
|
||||
onClick={() =>
|
||||
this.setState({
|
||||
@ -229,7 +222,7 @@ export class CreateNewModal extends Component {
|
||||
}
|
||||
>
|
||||
Import Github Repository
|
||||
</button>*/}
|
||||
</button>
|
||||
|
||||
{this.state.isGhRepoInputVisible ? (
|
||||
<div>
|
||||
@ -245,7 +238,7 @@ export class CreateNewModal extends Component {
|
||||
</div>
|
||||
) : null}
|
||||
</p>
|
||||
</div>
|
||||
</div>*/}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { h, Component } from 'preact';
|
||||
|
||||
function hyphenate(text) {
|
||||
return text.replace(/\s/g, '-');
|
||||
if (text.replace) {
|
||||
return text.replace(/\s/g, '-');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
const ID_PREFIX = 'tab-panel-';
|
||||
|
||||
@ -63,7 +66,7 @@ export default class Tabs extends Component {
|
||||
render() {
|
||||
const tabs = this.props.children;
|
||||
return (
|
||||
<div class="tabs">
|
||||
<div class={`tabs ${this.props.horizontal ? 'tabs--horizontal' : ''}`}>
|
||||
<div
|
||||
class="tabs__tablist"
|
||||
role="tablist"
|
||||
@ -79,8 +82,8 @@ export default class Tabs extends Component {
|
||||
))}
|
||||
</div>
|
||||
<div class="tabs__tabpanel-wrap">
|
||||
{tabs.map(
|
||||
(child, index) => (this.state.selectedTab === index ? child : null)
|
||||
{tabs.map((child, index) =>
|
||||
this.state.selectedTab === index ? child : null
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -36,3 +36,7 @@ export function AutoFocusInput(props) {
|
||||
export function Divider(props) {
|
||||
return <div class={`divider ${props.vertical ? 'divider--vertical' : ''}`} />;
|
||||
}
|
||||
|
||||
export function BetaTag() {
|
||||
return <span class="beta-tag">Beta</span>;
|
||||
}
|
||||
|
@ -123,6 +123,12 @@ button {
|
||||
.jc-sb {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.fxd-c {
|
||||
flex-direction: column;
|
||||
}
|
||||
.fxw-w {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.fr {
|
||||
float: right;
|
||||
@ -1610,19 +1616,15 @@ body > #demo-frame {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*
|
||||
.web-maker-with-tag:after {
|
||||
content: 'BETA';
|
||||
position: relative;
|
||||
left: 3px;
|
||||
top: -7px;
|
||||
.beta-tag {
|
||||
border-radius: 4px;
|
||||
background: #b76b29;
|
||||
text-transform: uppercase;
|
||||
background: #c68955;
|
||||
color: white;
|
||||
letter-spacing: 0.6px;
|
||||
padding: 2px;
|
||||
font-size: 10px;
|
||||
} */
|
||||
padding: 2px 5px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.is-extension .web-maker-with-tag:after {
|
||||
display: none;
|
||||
@ -1948,7 +1950,7 @@ while the theme CSS file is loading */
|
||||
display: flex;
|
||||
}
|
||||
.tabs__tablist {
|
||||
margin-right: 40px;
|
||||
/* margin-right: 40px; */
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tabs__tab {
|
||||
@ -1961,11 +1963,23 @@ while the theme CSS file is loading */
|
||||
color: inherit;
|
||||
}
|
||||
.tabs__tab--selected {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.tabs__tabpanel-wrap {
|
||||
flex: 1;
|
||||
}
|
||||
.tabs__tabpanel {
|
||||
padding: 2em;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-radius: 5px;
|
||||
}
|
||||
.tabs--horizontal {
|
||||
flex-direction: column;
|
||||
}
|
||||
.tabs--horizontal .tabs__tablist {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
body {
|
||||
|
Loading…
x
Reference in New Issue
Block a user