fix: person bricks should center name

otherwise bricks are at the left and -50% translateY puts them
off-center, while centering long name
This commit is contained in:
efim 2023-11-22 06:14:58 +00:00
parent f4c331983c
commit fad258a537
4 changed files with 51 additions and 58 deletions

View File

@ -215,15 +215,15 @@ func roomTemplatesPreview(
var person1 = rooms.Person{ var person1 = rooms.Person{
Id: rooms.PersonId(100), Id: rooms.PersonId(100),
Name: "test person 1", Name: "test person name 1",
} }
var person2 = rooms.Person{ var person2 = rooms.Person{
Id: rooms.PersonId(200), Id: rooms.PersonId(200),
Name: "test person 2", Name: "test person name 2",
} }
var person3 = rooms.Person{ var person3 = rooms.Person{
Id: rooms.PersonId(300), Id: rooms.PersonId(300),
Name: "test person 3", Name: "test person name 3",
} }
aRoom := rooms.Room{ aRoom := rooms.Room{
Name: "test", Name: "test",

View File

@ -538,10 +538,6 @@ video {
position: absolute; position: absolute;
} }
.relative {
position: relative;
}
.left-1\/2 { .left-1\/2 {
left: 50%; left: 50%;
} }
@ -570,6 +566,10 @@ video {
height: 3.5rem; height: 3.5rem;
} }
.h-4\/5 {
height: 80%;
}
.h-\[var\(--brick-height\)\] { .h-\[var\(--brick-height\)\] {
height: var(--brick-height); height: var(--brick-height);
} }
@ -636,10 +636,6 @@ video {
grid-template-rows: auto 1fr; grid-template-rows: auto 1fr;
} }
.flex-row {
flex-direction: row;
}
.flex-col { .flex-col {
flex-direction: column; flex-direction: column;
} }
@ -648,6 +644,10 @@ video {
place-content: center; place-content: center;
} }
.items-center {
align-items: center;
}
.gap-4 { .gap-4 {
gap: 1rem; gap: 1rem;
} }
@ -656,11 +656,6 @@ video {
gap: 1.5rem; gap: 1.5rem;
} }
.gap-x-3 {
-moz-column-gap: 0.75rem;
column-gap: 0.75rem;
}
.rounded { .rounded {
border-radius: 0.25rem; border-radius: 0.25rem;
} }
@ -731,6 +726,10 @@ video {
background-color: rgb(254 240 138 / var(--tw-bg-opacity)); background-color: rgb(254 240 138 / var(--tw-bg-opacity));
} }
.p-10 {
padding: 2.5rem;
}
.p-3 { .p-3 {
padding: 0.75rem; padding: 0.75rem;
} }

View File

@ -27,19 +27,6 @@
</div> </div>
{{ end }} {{ end }}
<h2>For each type</h2>
{{ range .Bricks }}
<div class="border-2">for {{ .Name }}</div>
<div
class="border-2 p-3 flex flex-row gap-x-3"
style="--brick-color: var({{ .ColorClass }})"
>
{{ template "inactiveBrick" .ColorClass }} {{ template "raisedBrick"
.ColorClass }} {{ template "speakerBrick" .ColorClass }} {{ template
"markBrick" .ColorClass }}
</div>
{{ end }}
<h2>Now for BrickData taking parametrized template name</h2> <h2>Now for BrickData taking parametrized template name</h2>
{{ define "brick" }} {{ define "brick" }}
{{ if eq .TemplateType "inactiveBrick" }} {{ if eq .TemplateType "inactiveBrick" }}
@ -57,18 +44,20 @@
<p>expected to be called with personData</p> <p>expected to be called with personData</p>
{{ define "personBlocks" }} {{ define "personBlocks" }}
<div class="person-bricks" id="person-{{.Index}}" style="--i: {{ .Index }}"> <div class="person-bricks flex flex-col items-center"
id="person-{{.Index}}" style="--i: {{ .Index }}">
{{ range .BricksForPerson }} {{ template "brick" . }} {{ end }} {{ range .BricksForPerson }} {{ template "brick" . }} {{ end }}
<p>{{ .Name }}({{.Index}})</p> <p>{{ .Name }}</p>
</div> </div>
{{ end }} {{ end }}
<h2>And now i'll want to get all persons for a room</h2> <h2>And now i'll want to get all persons for a room</h2>
<p>expected be called with room *roomTableData</p> <p>expected be called with room *roomTableData</p>
<div class="h-4/5">
{{ define "roomPeople" }} {{ define "roomPeople" }}
<div <div
class="circle-container relative" class="circle-container "
style="--tan: {{ .Tangens }}; --m: {{ .Total }};" style="--tan: {{ .Tangens }}; --m: {{ .Total }};"
> >
{{ with .ArrowData }} {{ with .ArrowData }}
@ -94,3 +83,5 @@
{{ range .Persons }} {{ template "personBlocks" . }} {{ end }} {{ range .Persons }} {{ template "personBlocks" . }} {{ end }}
</div> </div>
{{end}} {{end}}
</div>

View File

@ -1,4 +1,5 @@
{{define "main-content"}} {{define "main-content"}}
<div style="--d: 10rem">
<h2>For each type</h2> <h2>For each type</h2>
<section class="grid grid-cols-5 border-4 gap-4"> <section class="grid grid-cols-5 border-4 gap-4">
@ -27,8 +28,10 @@
<h2>And now i'll want to get all persons for a room</h2> <h2>And now i'll want to get all persons for a room</h2>
<div class="grid place-content-center"> <div class="grid place-content-center p-10">
{{ template "roomPeople" .ARoom }} {{ template "roomPeople" .ARoom }}
</div> </div>
{{end}} {{end}}
</div>