fix bug in Component
A leftover from when there was only the A component function, this bug was not found earlier because we used templates instead of tags most of the time.
This commit is contained in:
		@ -21,11 +21,16 @@ def Component(
 | 
			
		||||
    if isinstance(children, str):
 | 
			
		||||
        children = [children]
 | 
			
		||||
    childrenBlob = "\n".join(children)
 | 
			
		||||
    attributesList = [f'{name} = "{value}"' for name, value in attributes]
 | 
			
		||||
    attributesBlob = " ".join(attributesList)
 | 
			
		||||
    if len(attributes) == 0:
 | 
			
		||||
        attributesBlob = ""
 | 
			
		||||
    else:
 | 
			
		||||
        attributesList = [f'{name}="{value}"' for name, value in attributes]
 | 
			
		||||
        # make attribute list into a string
 | 
			
		||||
        # and insert space between tag and attribute list
 | 
			
		||||
        attributesBlob = f" {" ".join(attributesList)}"
 | 
			
		||||
    tag: str = ""
 | 
			
		||||
    if tag_name != "":
 | 
			
		||||
        tag = f"<a {attributesBlob}>{childrenBlob}</a>"
 | 
			
		||||
        tag = f"<{tag_name}{attributesBlob}>{childrenBlob}</{tag_name}>"
 | 
			
		||||
    elif template != "":
 | 
			
		||||
        tag = render_to_string(
 | 
			
		||||
            template,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user