Skip to content

Commit

Permalink
feat: header image custom width (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed May 29, 2024
1 parent 5d710af commit d3031d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ class UserAdmin(ModelAdmin):
"path": "some/path/picture.jpg,
"squared": True, # Picture is displayed in square format, if empty circle
"borderless": True # Picture will be displayed without border
"width": 64, # Removes default width. Use together with height
"height": 48, # Removes default height. Use together with width
}
]
```
Expand Down
4 changes: 2 additions & 2 deletions src/unfold/templates/unfold/helpers/display_header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<span class="flex gap-4 items-center">
{% if value.3 and value.3.path %}
<span class="bg-center bg-cover bg-white flex font-medium h-8 justify-center overflow-hidden max-w-8 min-w-8 dark:bg-gray-900 dark:border-gray-700 {% if value.3.squared %}rounded-sm{% else %}rounded-full{% endif %}{% if not value.3.borderless %} border{% endif %}">
<img loading="lazy" src="{{ value.3.path }}" class="object-cover" />
<span class="bg-center bg-cover bg-white flex font-medium justify-center overflow-hidden dark:bg-gray-900 dark:border-gray-700 {% if value.3.squared %}rounded-sm{% else %}rounded-full{% endif %}{% if not value.3.borderless %} border{% endif %}{% if not value.3.width or not value.3.height %}h-8 max-w-8 min-w-8{% endif %}">
<img loading="lazy" src="{{ value.3.path }}" class="object-cover" {% if value.3.width %}width="{{ value.3.width }}"{% endif %} {% if value.3.height %}height="{{ value.3.height }}"{% endif %}/>
</span>
{% elif value.2 %}
<span class="bg-white border flex font-medium h-8 justify-center items-center rounded-full text-xs uppercase w-8 dark:bg-gray-900 dark:border-gray-700">
Expand Down

0 comments on commit d3031d6

Please sign in to comment.