Giter Site home page Giter Site logo

Use css grid to layout form about jafar HOT 11 CLOSED

yahoo avatar yahoo commented on May 18, 2024 2
Use css grid to layout form

from jafar.

Comments (11)

galhavivi avatar galhavivi commented on May 18, 2024 2

pr - #65
demo - https://yahoo.github.io/jafar/demo-react-layout.html#/item/sections-grid/html

available on v1.0.7

from jafar.

WangLarry avatar WangLarry commented on May 18, 2024 1

Beautiful and elegant! @galhavivi

from jafar.

galhavivi avatar galhavivi commented on May 18, 2024 1

I agree its more clean :) and when I'll use it ill probably do like you suggested... but i think it might be better to keep the demo with the getGrid so it will be more clear to people that the grid configuration is an object of { templateAreas, elements } - rather than array (they might miss the last row of sections.map if well change it)

from jafar.

WangLarry avatar WangLarry commented on May 18, 2024 1

'benefits' can occupy two rows. See my updated picture

from jafar.

galhavivi avatar galhavivi commented on May 18, 2024 1

done :) i was slow here lol

from jafar.

galhavivi avatar galhavivi commented on May 18, 2024

@WangLarry
Thats a great idea and definitely more intuitive, thank you! :)
Let me check how we can offer a different / newer sections version based on grid.
we can have for example that each section will get content - array of strings (or array of arrays) instead of boxes like:

sections: [{
   id: 'basic-info',
   title: 'Basic Info',
   content: [
       "name name . . age age . .",
       ". . . . phone . . ."
   ],
}]

image

BTW - our advanced goal is to create also a Layout editor, where you will have all your defined fields in a list and you can drag & drop fields to some area - to create different layouts, and behind the scene it will translate to the sections json.
We had this feature in a prior version of Jafar in our portal, and it was very useful for non UI developers - such as backend devs or product manages to create different layouts for the same form based on user role / permissions.
For example - one set of user can get a different layout that another set of users (different sections and fields order) - but both based on the same form model fields. :)

from jafar.

WangLarry avatar WangLarry commented on May 18, 2024

Maybe It looks pleasant to get rid of 'getGrid()' in array?

grid: [
    'firstName lastName .',
    'personalId address .',
  ],

...

sections.map(section => ({...section, grid: getGrid(section.grid)})

Oh, current syntax can style every row.

from jafar.

WangLarry avatar WangLarry commented on May 18, 2024

Maybe we should show the feature of gird - can span rows. For example:

  grid: getGrid([
    'department  benefits    .    ',
    'level        benefits    .    ',
  ]),

from jafar.

galhavivi avatar galhavivi commented on May 18, 2024

Not sure i understand what you meant ..?

from jafar.

WangLarry avatar WangLarry commented on May 18, 2024

无标题-2020-07-09-0153

from jafar.

galhavivi avatar galhavivi commented on May 18, 2024

like this?

image

from jafar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.