1 module uim.bootstrap.bs5.classes.obj;
2 
3 import uim.bootstrap;
4 
5 class DBS5Obj : DH5Obj {
6 	mixin(H5This!("DIV"));
7 
8 	// Adding margins  
9 	O margins(this O)(string[] values...) {
10 		this.margins(values);
11 		return cast(O) this;
12 	}
13 	O margins(this O)(string[] values) {
14 		foreach(v; values) this.classes("m"~v);
15 		return cast(O) this;
16 	}
17 	unittest {
18 		assert(Assert(BS5Obj.margins("t-2"), `<div class="mt-2"></div>`));
19 		assert(Assert(BS5Obj.margins("t-sm-2", "t-lg-4"), `<div class="mt-sm-2 mt-lg-4"></div>`));
20 	}
21 
22 	/// Adding paddings
23 	O paddings(this O)(string[] values...)	{
24 		this.paddings(values);
25 		return cast(O) this;
26 	}
27 	O paddings(this O)(string[] values)	{
28 		foreach(v; values) this.classes("p"~v);
29 		return cast(O) this;
30 	}
31 	unittest {
32 		assert(Assert(BS5Obj.paddings("t-2"), `<div class="pt-2"></div>`));
33 	}
34 
35 /* 	/// Clear border 
36 	O noPadding(this O)(string side = null) { 
37 		this.classes("p-0");
38 		return cast(O) this;
39 	}
40 
41 	/// Adding border 
42 	O border(this O)(int value) { 
43 		if (value > 0) this.classes("border-"~to!string(value));
44 		else this.classes("border");
45 		return cast(O) this;
46 	 }
47 	O border(this O)(string side, int value) { return border(side~"-"~to!string(value)); }
48 	O border(this O)(string value = null) {
49 		if (value.length > 0) this.classes("border-"~value);
50 		else this.classes("border");
51 		return cast(O) this;
52 	}
53 	unittest {
54 		assert(Assert(BS5Obj.border, `<div class="border"></div>`));
55 		assert(Assert(BS5Obj.border(1), `<div class="border-1"></div>`));
56 		assert(Assert(BS5Obj.border("top"), `<div class="border-top"></div>`));
57 	}
58 
59 	/// Clear border 
60 	O noBorder(this O)(string side = null) { 
61 		if (side.length > 0) this.classes("border-"~side~"-0");
62 		else this.classes("border-0");
63 		return cast(O) this;
64 	}
65 	unittest {
66 		assert(Assert(BS5Obj.noBorder, `<div class="border-0"></div>`));
67 	}
68 
69 	/// Set border color 
70 	O borderColor(this O)(string color) { 
71 		if (color.length > 0) this.classes("border-"~color);
72 		return cast(O) this;
73 	}
74 	unittest {
75 		assert(Assert(BS5Obj.borderColor("primary"), `<div class="border-primary"></div>`));
76 		assert(Assert(BS5Obj.border.borderColor("primary"), `<div class="border border-primary"></div>`));
77 	}
78 
79 	/// Change rounded of corners 
80 	O rounded(this O)(string value = "") {
81 		if (value.length > 0) this.classes("rounded-"~value);
82 		else this.classes("rounded");
83 		return cast(O) this;
84 	}
85 	unittest {
86 		assert(Assert(BS5Obj.rounded, `<div class="rounded"></div>`));
87 		assert(Assert(BS5Obj.rounded("top"), `<div class="rounded-top"></div>`));
88 	}
89 
90 	/// Clear rounded
91 	O noRounded(this O)() { 
92 		this.classes("rounded-0");
93 		return cast(O) this;
94 	}
95 	unittest {
96 		assert(Assert(BS5Obj.noRounded, `<div class="rounded-0"></div>`));
97 	}
98 
99 	/// Set size of rounded
100 	O roundedSize(this O)(string value) {
101 		if (value.length > 0) this.classes("rounded-"~value);
102 		return cast(O) this;
103 	}
104 	unittest {
105 		assert(Assert(BS5Obj.roundedSize("lg"), `<div class="rounded-lg"></div>`));
106 	}
107 
108 	O clearfix(this O)() { 
109 		this.classes("clearfix");
110 		return cast(O) this;
111 	}
112 	unittest {
113 		assert(Assert(BS5Obj.clearfix, `<div class="clearfix"></div>`));
114 	}
115 
116 	O closeButton(this O)(string icon = "&times;") { 
117 		this.content(BS5Button(["close"], ["aria-label":"Close"], H5Span(["aria-label":"true"], icon)));
118 		return cast(O) this;
119 	}
120 	unittest {
121 		assert(Assert(BS5Obj.closeButton, `<div><button class="btn close" aria-label="Close" type="button"><span aria-label="true">&times;</span></button></div>`));
122 	}
123 
124 	/// Setting text color
125 	O textColor(this O)(string color, int value) { return textColor(color, to!string(value)); }
126 	O textColor(this O)(string color, string value = null) {
127 		if (value.length > 0) this.classes("text-"~color~"-"~value);
128 		else this.classes("text-"~color);
129 		return cast(O) this;
130 	}
131 	unittest {
132 		assert(Assert(BS5Obj.textColor("primary"), `<div class="text-primary"></div>`));
133 		assert(Assert(BS5Obj.textColor("black", "50"), `<div class="text-black-50"></div>`));
134 	}
135 
136 	/// Setting background color
137 	O background(this O)(string color, int value) { return background(color, to!string(value)); }
138 	O background(this O)(string color, string value = null) {
139 		if (value.length > 0) this.classes("bg-"~color~"-"~value);
140 		else this.classes("bg-"~color);
141 		return cast(O) this;
142 	}
143 	unittest {
144 		assert(Assert(BS5Obj.background("primary"), `<div class="bg-primary"></div>`));
145 	}
146 
147 	/// Setting display
148 	O display(this O)(string value) { return this.display(null, value); }
149 	O display(this O)(string breakpoint, string value) {
150 		if (breakpoint.length > 0) this.classes("d-"~breakpoint~"-"~value);
151 		else this.classes("d-"~value);
152 		return cast(O) this;
153 	}
154 	unittest {
155 		assert(Assert(BS5Obj.display("none"), `<div class="d-none"></div>`));
156 		assert(Assert(BS5Obj.display("sm", "block"), `<div class="d-sm-block"></div>`));
157 	}
158 	
159 	/// Setting print display
160 	O print(this O)(string value) {
161 		if (value.length > 0) this.classes("d-print-"~value);
162 		return cast(O) this;
163 	}
164 	unittest {
165 		assert(Assert(BS5Obj.print("none"), `<div class="d-print-none"></div>`));
166 	}
167  */
168 }
169 
170 mixin(H5Calls!"BS5Obj");
171 
172 unittest {
173 	assert(Assert(BS5Obj, "<div></div>"));
174 }