Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: animates ProgressIcon #82

Merged
merged 4 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/utilities/create-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ export default function createComponentFromSvg(pathToSvg: string, svgFileName: s
if (path.attr('stroke')) {
path?.attr('stroke', 'currentColor')
}
// Add animation for ProgressIcon
if (name === 'progress-icon') {
// Add transform origin
path.attr('transform-origin', 'center')
$cheerio('svg').append('<animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0" to="360" dur="1.5s" repeatCount="indefinite" />')
}
}

// Get the innerHTML of the <svg> element, stripping any leading or trailing newlines
Expand Down
2 changes: 1 addition & 1 deletion src/tests/__snapshots__/ProgressIcon.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span data-v-c7351aba="" class="kui-icon progress-icon" data-testid="kui-icon-wrapper-progress-icon" style="box-sizing: border-box; color: rgb(0, 68, 244); display: inline-flex; height: 32px; line-height: 0; width: 32px;"><svg data-v-c7351aba="" data-testid="kui-icon-svg-progress-icon" fill="none" height="100%" role="img" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg"><title data-v-c7351aba="" data-testid="kui-icon-svg-title">My custom title</title><path data-v-c7351aba="" d="M12 22C10.6333 22 9.34167 21.7375 8.125 21.2125C6.90833 20.6875 5.84583 19.9708 4.9375 19.0625C4.02917 18.1542 3.3125 17.0917 2.7875 15.875C2.2625 14.6583 2 13.3667 2 12C2 10.6167 2.2625 9.32083 2.7875 8.1125C3.3125 6.90417 4.02917 5.84583 4.9375 4.9375C5.84583 4.02917 6.90833 3.3125 8.125 2.7875C9.34167 2.2625 10.6333 2 12 2C12.2833 2 12.5208 2.09583 12.7125 2.2875C12.9042 2.47917 13 2.71667 13 3C13 3.28333 12.9042 3.52083 12.7125 3.7125C12.5208 3.90417 12.2833 4 12 4C9.78333 4 7.89583 4.77917 6.3375 6.3375C4.77917 7.89583 4 9.78333 4 12C4 14.2167 4.77917 16.1042 6.3375 17.6625C7.89583 19.2208 9.78333 20 12 20C14.2167 20 16.1042 19.2208 17.6625 17.6625C19.2208 16.1042 20 14.2167 20 12C20 11.7167 20.0958 11.4792 20.2875 11.2875C20.4792 11.0958 20.7167 11 21 11C21.2833 11 21.5208 11.0958 21.7125 11.2875C21.9042 11.4792 22 11.7167 22 12C22 13.3667 21.7375 14.6583 21.2125 15.875C20.6875 17.0917 19.9708 18.1542 19.0625 19.0625C18.1542 19.9708 17.0958 20.6875 15.8875 21.2125C14.6792 21.7375 13.3833 22 12 22Z" fill="currentColor"></path></svg></span>
<span data-v-c7351aba="" class="kui-icon progress-icon" data-testid="kui-icon-wrapper-progress-icon" style="box-sizing: border-box; color: rgb(0, 68, 244); display: inline-flex; height: 32px; line-height: 0; width: 32px;"><svg data-v-c7351aba="" data-testid="kui-icon-svg-progress-icon" fill="none" height="100%" role="img" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg"><title data-v-c7351aba="" data-testid="kui-icon-svg-title">My custom title</title><path data-v-c7351aba="" d="M12 22C10.6333 22 9.34167 21.7375 8.125 21.2125C6.90833 20.6875 5.84583 19.9708 4.9375 19.0625C4.02917 18.1542 3.3125 17.0917 2.7875 15.875C2.2625 14.6583 2 13.3667 2 12C2 10.6167 2.2625 9.32083 2.7875 8.1125C3.3125 6.90417 4.02917 5.84583 4.9375 4.9375C5.84583 4.02917 6.90833 3.3125 8.125 2.7875C9.34167 2.2625 10.6333 2 12 2C12.2833 2 12.5208 2.09583 12.7125 2.2875C12.9042 2.47917 13 2.71667 13 3C13 3.28333 12.9042 3.52083 12.7125 3.7125C12.5208 3.90417 12.2833 4 12 4C9.78333 4 7.89583 4.77917 6.3375 6.3375C4.77917 7.89583 4 9.78333 4 12C4 14.2167 4.77917 16.1042 6.3375 17.6625C7.89583 19.2208 9.78333 20 12 20C14.2167 20 16.1042 19.2208 17.6625 17.6625C19.2208 16.1042 20 14.2167 20 12C20 11.7167 20.0958 11.4792 20.2875 11.2875C20.4792 11.0958 20.7167 11 21 11C21.2833 11 21.5208 11.0958 21.7125 11.2875C21.9042 11.4792 22 11.7167 22 12C22 13.3667 21.7375 14.6583 21.2125 15.875C20.6875 17.0917 19.9708 18.1542 19.0625 19.0625C18.1542 19.9708 17.0958 20.6875 15.8875 21.2125C14.6792 21.7375 13.3833 22 12 22Z" fill="currentColor" transform-origin="center"></path><animateTransform data-v-c7351aba="" attributeName="transform" attributeType="XML" type="rotate" from="0" to="360" dur="1.5s" repeatCount="indefinite"></animateTransform></svg></span>
2 changes: 1 addition & 1 deletion svg/solid/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.