-
Notifications
You must be signed in to change notification settings - Fork 42
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
website: Update variables documentation & demos #1334
Merged
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5909d35
Initial push.
FlyersPh9 578944f
Remove `<RelatedComponents>`.
FlyersPh9 63b4435
Lower each `<h*>` 1 level.
FlyersPh9 fea0170
Update duration demo.
FlyersPh9 cbb0104
Re-add `1rem` = `m` and mention "root font size".
FlyersPh9 09a1409
Update apps/website/src/pages/docs/variables.mdx
FlyersPh9 091a499
Update apps/website/src/pages/docs/variables.mdx
FlyersPh9 485b59e
Update apps/website/src/pages/docs/variables.mdx
FlyersPh9 62423df
Update apps/website/src/pages/docs/variables.mdx
FlyersPh9 f74d77c
Update apps/website/src/pages/docs/variables.mdx
FlyersPh9 417a902
Intro paragraph change.
FlyersPh9 b1ca68b
Add component height variable names.
FlyersPh9 2ee3f04
Add color & opacity pairing section with accessibility warning.
FlyersPh9 1d97401
Duration demo now requires a click to activate.
FlyersPh9 ad266d0
Duration demo cleanup
FlyersPh9 8adfd39
Merge branch 'dev' into jon/documentation-site-variables
FlyersPh9 46198dd
Replace with
FlyersPh9 8dbb671
Update apps/website/src/pages/docs/variables.mdx
FlyersPh9 6022c9d
Update duration demo with Mayank's suggestion
FlyersPh9 86682a5
Trying to be more clear about the range within opacity and duration.
FlyersPh9 83222ef
Sort sections alphabetically
FlyersPh9 84cec85
Merge branch 'dev' into jon/documentation-site-variables
gretanausedaite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
import Wrapper from './_wrapper.astro'; | ||
const durations = ['0', '1', '2', '3']; | ||
--- | ||
|
||
<Wrapper class='wrapper'> | ||
{ | ||
durations.map((duration) => ( | ||
<duration-item duration={`--iui-duration-${duration}`}> | ||
<button>{duration}</button> | ||
</duration-item> | ||
)) | ||
} | ||
</Wrapper> | ||
|
||
<script> | ||
customElements.define( | ||
'duration-item', | ||
class extends HTMLElement { | ||
connectedCallback() { | ||
const duration = getComputedStyle(this).getPropertyValue(this.getAttribute('duration')); | ||
const durationMs = Math.max(0.001, parseFloat(duration) * 1000); | ||
const button = this.querySelector('button'); | ||
|
||
button.addEventListener('click', () => { | ||
button.animate([{ opacity: 0 }], { duration: durationMs }); | ||
}); | ||
} | ||
} | ||
); | ||
</script> | ||
|
||
<style> | ||
duration-item button { | ||
border: none; | ||
padding: var(--space-3); | ||
width: var(--space-8); | ||
height: var(--space-8); | ||
border-radius: var(--space-1); | ||
box-shadow: 0 0 4px hsl(0 0% 0% / 20%); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: var(--iui-color-background); | ||
color: var(--iui-color-foreground-2); | ||
cursor: pointer; | ||
} | ||
</style> |
29 changes: 29 additions & 0 deletions
29
apps/website/src/components/variables/SizesInputDemo.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
import Wrapper from './_wrapper.astro'; | ||
import Item from './_item.astro'; | ||
--- | ||
|
||
<Wrapper class='wrapper'> | ||
<Item class='item'>small</Item> | ||
<Item class='item'>medium</Item> | ||
FlyersPh9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Item class='item'>large</Item> | ||
</Wrapper> | ||
|
||
<style lang='scss'> | ||
.wrapper { | ||
align-items: center; | ||
} | ||
|
||
.item { | ||
border-radius: var(--iui-border-radius-1); | ||
height: var(--iui-component-height); | ||
|
||
&:first-child { | ||
height: var(--iui-component-height-small); | ||
} | ||
|
||
&:last-child { | ||
height: var(--iui-component-height-large); | ||
} | ||
} | ||
</style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demo is a bit intense. Suggestions for an alternative demo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a gentle fade?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized my animation was incorrect. It was applying the duration speed to expand AND collapse. I've added
animation-direction: alternate;
so now the animation is half of what it was. Still a bit intense, but better than before.I will look into other options next time I work on this PR, with the time I have today this is the best I could do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A non-repeating animation that can be triggered by the user would be the best option. For inspiration, see https://open-props.style/#animations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to require a user's click to trigger animation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm it's not working for me. did you forget to add a script?
Screen.Recording.2023-06-15.at.1.44.50.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can fix it using this code:
DurationDemo.astro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested it in Brave & Safari, those both seems to be working.
![duration-demo](https://private-user-images.githubusercontent.com/849817/246200290-4aae8e65-ea0b-4225-ac9e-e530c383c8bb.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTU2MTcsIm5iZiI6MTczOTA1NTMxNywicGF0aCI6Ii84NDk4MTcvMjQ2MjAwMjkwLTRhYWU4ZTY1LWVhMGItNDIyNS1hYzllLWU1MzBjMzgzYzhiYi5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQyMjU1MTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNmRkMzdhZDJlNWRlYjU1ZTJjZmQ2N2NiNjMwNzJiMTEyYWMwN2E4YTk0MDVmMGVjYjBmMDM2YWRmOTViN2NjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.m8LQqYgB80rom-2O7CJSqlvJ9Y6iEzXhWoatO_wrczs)
Firefox however is not working. 😫
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, the suggested code works in all browsers!