Circular Completion: Add Project

How to fill the circular progress bar

First take note ot the sds-circularCompletion__progress element's r (radius) attribute, which is 55.

The way to calculate the progress amount for the circluar progress bar is as follows:

  • The formula: (2 * PI * r) is used to establish the circle's stroke-daharray value, hereafter DASHA
  • Calculating the progress is done like so: (DASHA * progressPercentage) / 100
  • The result is to be used as the sds-circularCompletion__progress element's stroke-dasharray attribute's first parameter, which will change accordingly
  • Example: 50% progress = (346*50)/100 = stroke-dasharray="173 346"
<div class="sds-circularCompletion -dashed">

    <a class="sds-circularCompletion__link d-flex flex-column align-items-center justify-content-center" href="#!">
        <span class="sds-iconCircle -primaryG -smaller" aria-hidden="true">

            <span class="sds-icon sds-icon-plus"></span>

        </span>

        <span class="sds-circularCompletion__more sds-textHelper sds-textSemiBold">Nouveau Projet</span>
    </a>

</div>
<div class="{{ namespace }}circularCompletion{% for mod in modifiers %} {{ mod }}{% endfor %}{% for mod in classes %} {{ mod }}{% endfor %}">
	{% if addProject %}
		<a class="{{ namespace }}circularCompletion__link d-flex flex-column align-items-center justify-content-center" href="#!">
			{% render "@icon-circle-regular--primary-gradient-small" %}
			<span class="{{ namespace }}circularCompletion__more {{ namespace }}textHelper {{ namespace }}textSemiBold">Nouveau Projet</span>
		</a>
	{% else %}
		<svg class="{{ namespace }}circularCompletion__circleWrapper" viewBox="0 0 118 118" preserveAspectRatio="none" version="1.1" xmlns="http://www.w3.org/2000/svg">
			<circle fill="none" class="{{ namespace }}circularCompletion__circle" r="55" cx="59" cy="59" stroke-dasharray="346"></circle>
			<circle fill="none" class="{{ namespace }}circularCompletion__circle {{ namespace }}circularCompletion__progress" r="55" cx="59" cy="59" stroke-dasharray="{{ (346 * progress) / 100 }} 346"></circle>
		</svg>
		{% if externalImage %}
			<img class="{{ namespace }}circularCompletion__img" src="{{ img }}" alt="img alt">
		{% else %}
			<img class="{{ namespace }}circularCompletion__img" src="{{ (mediaPath+img) | path }}" alt="img alt">
		{% endif %}
		{% if complete %}
			{% render "@icon-circle-regular--success-100-small",{
				icon: "icon-check",
				classes: [namespace + "circularCompletion__complete"],
				helperText: "Project Complete"
			},true %}
		{% endif %}
	{% endif %}
	{% if dropdown %}
		<div class="{{ namespace }}circularCompletion__dropdown dropdown">
			{% render "@icon-btn-secondary",{
				icon: "icon-more",
				attrs: {
					"data-reference": "parent",
					"data-boundary": "window",
					"data-toggle": "dropdown"
				}
			},true %}
			{% render "@snet-action-menu",{
				classes: ["dropdown-menu-right"]
			},true %}
		</div>
	{% endif %}
</div>
  • Content:
    /* variables specific to current element */
    
    $circular-completion-dimensions: 112px;
    $circular-completion-border-radius: map-deep-get($token-radius-map, "circle");
    
    .#{$namespace}circularCompletion {
    
    	/* Save root element context for easy access if nesting is needed */
    
    	$self: &;
    
    	/* properties of current element  + media queries */
    
    	position: relative;
    	width: $circular-completion-dimensions;
    	height: $circular-completion-dimensions;
    	border-radius: $circular-completion-border-radius;
    
    	display: flex;
    
    	/* Pseudo Elements */
    
    	&::before {
    	}
    
    	&::after {
    	}
    
    	/*
    	Include elements that are linked to the current element but have to reside at the root level of the stylesheet
    	(e.g: keyframes)
    	*/
    	@at-root {
    	}
    
    
    	/* children - write selector in full in comments in order to facilitate search */
    
    	// circularCompletion__circle
    	&__circle {
    
    		// follows same logic as parent
    
    		@include custom-prop-fallback("stroke", "sys-color-border-primary-subtle");
    		stroke-width: $border-width * 2;
    		transform-origin: center center;
    
    	}
    
    	&__inner,
    	&__circleWrapper {
    
    		width: 100%;
    		height: 100%;
    
    	}
    
    	&__progress {
    
    		transform: rotate(-90deg);
    		stroke: currentColor;
    
    	}
    
    	&__more {
    
    		@include custom-prop-fallback("color", "sys-color-text-secondary-vivid");
    		margin-top: map-deep-get($token-spacer-unit-map, "4");
    		padding: 0 map-deep-get($token-spacer-unit-map, "16");
    		text-align: center;
    
    	}
    
    	&__img {
    
    		width: 80px;
    		height: 80px;
    		border-radius: $circular-completion-border-radius;
    		object-fit: cover;
    
    	}
    
    	&__complete {
    
    		@include custom-prop-fallback("color", "sys-color-background-accent-100");
    
    	}
    
    	&__inner,
    	&__circleWrapper,
    	&__img,
    	&__complete {
    
    		position: absolute;
    		top: 50%;
    		left: 50%;
    		transform: translate(-50%,-50%);
    
    	}
    	
    	&__dropdown {
    
    		align-self: flex-start;
    		margin-left: auto;
    		z-index: z("medium"); // z-index works on position: static here because of the flex context DO NOT REMOVE
    
    		@media (hover: hover) {
    
    			opacity: 0;
    
    		}
    
    	}
    
    	&__link {
    
    		border-radius: $circular-completion-border-radius;
    
    		&::after {
    
    			content: "";
    			position: absolute;
    			top: $border-width*2;
    			right: $border-width*2;
    			bottom: $border-width*2;
    			left: $border-width*2;
    			border: $border-width*2 dashed;
    			@include custom-prop-fallback("border-color", "sys-color-border-primary-moderate");
    			border-radius: $circular-completion-border-radius;
    
    		}
    
    	}
    
    
    	/* modifiers */
    
    	// circularCompletion -altStyle
    	&.altStyle {
    
    		// follows same logic as base element
    
    	}
    
    	/* random parent element */
    	/* 
    	*
    	*   Syntax : .randomParentElt & {}
    	*
    	*/
    
    	/* Pseudo Classes */
    
    	&:hover {
    		@media (hover: hover) {
    
    			#{$self}__dropdown {
    
    				opacity: 1;
    
    			}
    
    			#{$self}__link {
    
    				&::after {
    					@include custom-prop-fallback("border-color", "sys-color-text-secondary-vivid");
    				}
    
    			}
    
    		}
    	}
    
    	&:focus {
    	}
    
    	&:active {
    	}
    
    	&:focus,
    	&:active {
    	}
    
    }
  • URL: /components/raw/snet-circular-completion/_circular-completion.scss
  • Filesystem Path: components/snet/molecules/circular-completion/_circular-completion.scss
  • Size: 2.9 KB