Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

32
LINES

< > BotCompany Repo | #1032577 // HtitledSection - successor of htitledSectionWithDiv. create titled section in HTML (like jSection) [not <section> tag]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4725L/28K).

// design by Kriti Shankar Senapati
sclass HtitledSection {
  S titleHTML;
  S backgroundColor = "#fff";
  S labelStyle = "width: auto; float: top; position: relative; top: -.6em; left:15px; background-color: " + backgroundColor;
  S innerDivID;
  S innerDivStyle;
  S innerDivClass;
  S outerDivClass;
  new MapSO outerDivParams;
  new MapSO innerDivParams;
  O contents;
  
  *() {}
  *(S *titleHTML) {}
  *(S *titleHTML, O *contents) {}
  
  S html() {
    outerDivParams.put("data-section", htmlDecode_dropTags(titleHTML));
    
    ret div(
      tag label(b("&nbsp;" + titleHTML + "&nbsp;"), style := labelStyle)
    + div(contents,
      paramsPlus(params_plusHTMLClass(
        params_stylePlus(innerDivParams,
          joinNemptiesWithSemicolon(innerDivStyle, "padding-left: 15px")),
        joinNemptiesWithSpace("sectionContents", innerDivClass)),
        id := innerDivID)),
      params_stylePlus("border: 2px solid",
        params_plusHTMLClass(outerDivParams, outerDivClass)));
  }
}

Author comment

Began life as a copy of #1030189

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032577
Snippet name: HtitledSection - successor of htitledSectionWithDiv. create titled section in HTML (like jSection) [not <section> tag]
Eternal ID of this version: #1032577/11
Text MD5: 41b80040d0704a7844ba4d5e1547f917
Transpilation MD5: 025a6338c046668ed1e44a05821993bf
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-23 02:03:00
Source code size: 1031 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 102 / 218
Version history: 10 change(s)
Referenced in: [show references]