Redmage/views/devices/put/nsfw_checkbox.templ

40 lines
900 B
Plaintext

package put
import "fmt"
import "github.com/tigorlazuardi/redmage/views/utils"
type NSFWCheckboxData struct {
Checked bool
EditMode bool
}
templ NSFWCheckbox(data NSFWCheckboxData) {
<div
x-data={ fmt.Sprintf(`{checked: %t}`, data.Checked) }
class={ utils.CXX("form-control w-full", true, "sm:col-span-2", data.EditMode) }
>
<label
class="label cursor-pointer border input input-bordered"
:class="{'input-primary': checked}"
>
<span
class="label-text"
:class="{'text-primary': checked}"
>Allow NSFW Images</span>
<input
type="checkbox"
checked?={ data.Checked }
class="checkbox"
:class="{'checkbox-primary': checked}"
name="nsfw"
value="1"
@change="checked = !checked"
/>
</label>
<span
class="label-text pl-1 mt-2"
:class="{'text-primary': checked}"
>Whether to allow NSFW images for current device.</span>
</div>
}