LeaVerou / dabblet

An interactive CSS playground
http://dabblet.com
817 stars 148 forks source link

Rethink the views & tabs system #80

Open LeaVerou opened 12 years ago

LeaVerou commented 12 years ago

The problem

The current system of views and tabs has quite a few issues:

The idea we settle on needs to:

Basically, the customizations that need to be allowed are:

I'm currently thinking of something that accepts a value similar to what the grid-template CSS value accepts, using the letters c for CSS, h for HTML and r for result. So the current views would be coded like:

With this it would be pretty easy to divide tabs in a different way than evenly. For example, if you want a vertical split with two thirds being CSS and one third being the result, it can easily be coded as "ccr". In the future, code about dragging could also be added, which snaps to tenths (to avoid overly verbose code) and generates the code automatically.

The UI could be a little arrow or eye icon on the right of every tab, with a textarea to set the layout for that tab. The title of the tab would then be extracted from the layout, with an algorithm like:

var title = "",
    titles = {c: 'CSS', h: 'HTML', r: 'Result'};

for (var letter in titles) {
    if (layout.indexOf(letter) > -1) {
        title += (title? '+' : '') + titles[letter];
    }
}

Since tabs will then lose their meaning as they are fully customizable, maybe there would also be a button there to delete and add tabs ("views").

One problem with that is that the current "Code over result" view cannot be represented in that format. Maybe it will be removed (I don't think it's being used much anyway) or a separate option could be added that generalizes it, making the result full page and the code occupying whatever it would occupy normally with the current layout. So, it would have the same layout code as the separate view.

Thoughts?

bigbossSNK commented 12 years ago

Here's a mockup, first with the settings tucked away,

and then expanded

Notes: Great interfaces don't misinterpret a user's actions. Currently, each time I switch browser tabs, dabblet thinks I want to change its settings. Move them left-side, no worries.

The tabs interface shouldn't be hard to code with a little pixie-dust. Erm, I mean JS.

matthewlein commented 12 years ago

I'm not sure that the views/arrangement necessarily needs to be stored with the dabblet data.

I think Dabblet use breaks down into 2 use-cases: creating and sharing.

For sharing, I think 95% will be sharing the preview view only. Then interested parties can check out the other views as they please. I don't see much use to share a dabblet in a specific order of views

For creating, I think user all have their own preferences of view order/arrangement. This could be stored locally only in localStorage, not part of the dabblet. Give people the option of 1,2, or 3 views, and horz/vert stack order. That way any dabblet opens with a user's prefs.

Each view could a tab in the upper right corner that says what its displaying (CSS/HTML, etc). I like that the header hides itself. Maybe the tabs could do the same. The tabs could be select menus that let you choose what they display, also stored locally.

I would want the view dividers to be draggable.

So data stored in the dabblet URL would just be its ID and whether its fullscreen preview or not. A normal Dabblet is viewed using the users prefs or the default 2-view split.

cssagogo commented 12 years ago

Love the tool. Don't love the navigation. The slide out tabs are not efficient. They should be attached to the edit boxes not the preview pane and they should always be present. I also think there should be a 3 panel view where you can see preview, html and css all together. Like jsfiddle minus the javascript window.