Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
K0K0V0K committed Nov 27, 2024
1 parent 7da6f86 commit 45a2d58
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main/java/koko/yayu/generator/ComponentGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.json.JSONObject;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.text.WordUtils;

public class ComponentGenerator {
Expand Down Expand Up @@ -63,21 +64,22 @@ public ComponentGenerator addField(
}

public String generate(JSONObject data) {
String re = String.format("<article class=\"panel %s\">\n", color);
re += String.format("<div class=\"panel-heading\">%s</div>\n", title);
String re = "<article class=\"message\"><div class=\"message-header\"><p>"
+ title
+ "</p></div><div class=\"message-body\"><table class=\"table is-striped is-fullwidth\">";
for (Map.Entry<String, String> field : displayNames.entrySet()) {
re += String.format("<a class=\"panel-block\">%s: %s</a>\n",
re += String.format("<tr><td>%s</td><td>%s</td></tr>\n",
field.getValue(), getValue(data, field.getKey()));
}
re += "</article>\n";
re += "</table></div></article>";
return re;
}

public String generate(List<JSONObject> data) {
String re = String.format("<article class=\"panel %s\">\n", color);
re += String.format("<div class=\"panel-heading\">%s</div>\n", title);
re += "<a class=\"panel-block\">";
re += "<table class=\"table\"><thead><tr>\n";
String re = "<article class=\"message\"><div class=\"message-header\"><p>"
+ title
+ "</p></div><div class=\"message-body\">"
+ "<table class=\"table is-striped is-fullwidth\"><thead><tr>";
for (Map.Entry<String, String> field : displayNames.entrySet()) {
re += String.format("<th>%s</th>\n", field.getValue());
}
Expand All @@ -89,7 +91,7 @@ public String generate(List<JSONObject> data) {
}
re += "</tr>\n";
}
re += "</tbody></table></a></article>\n";
re += "</tbody></table></div></article>\n";
return re;
}

Expand Down

0 comments on commit 45a2d58

Please sign in to comment.