@magnetis/astro
v3.3.0
Published
Magnetis design system
Downloads
21
Readme
Astro
A design system by Magnetis 👩🚀
Table of contents
- Introduction
- Supported libraries
- Adding Astro to your project
- Using Astro
- Contributing
- Troubleshooting
- Contact us
Introduction
Made for Magnetis' designers, developers, product managers, data analysts, data scientists, stakeholders and enthusiasts, Astro helps us protect the brand concepts, elevate consistency of user experience and increase the speed and efficiency of how we design and build products for our customers.
We believe that a good user experience is built with consistent design, well defined visual and interaction patterns, carefully built emotions and made for all. Therefore, Astro is essentially:
Atomic
Astro is built based on Atomic Design, so our designers and developers can use its style set and components to enhance our product interface, as a modular system that can be easily managed and updated.
Open
Magnetis believes that good design and experiences can impact the product market and society itself. Our design and code assets are open so we can contribute to the community and help new product teams.
Accessible
Design is meant to be for all. Astro style and components follow basic recommendations from the WCAG guidelines for accessibility, with tested contrast ratios and good practices in legibility and screen reading solutions. See WCAG >>
Supported libraries
For now, Astro only supports React as its official library.
Adding Astro to your project
Installing the dependency
Install Astro via terminal:
Run yarn add @magnetis/astro
or npm install @magnetis/astro
.
Using via CDN
<link
href="https://unpkg.com/@magnetis/astro/dist/astro.css"
rel="stylesheet"
type="text/css"
/>
Using Astro
Ready to start coding with Astro? Follow the instructions in the docs (astro.magnetis.com.br) to learn how to use our components. You'll also see how to apply attribute modifiers (such as classes) to your HTML elements and React components.
Here's a quick example. If you'd like to create a Display text styled in Astro typography:
Complete all install steps listed above;
Import Astro in your file through one of the following methods:
Inside the
<head>
tag:<head> <link href="/node_modules/@magnetis/astro/dist/astro.css" rel="stylesheet" type="text/css" /> </head>
With ES6 modules:
import "@magnetis/astro";
With commonjs:
require("@magnetis/astro");
Go to Astro's Typography page;
See that the "Display" section guides you to create a
<p>
element with a specific text display class;Replicate the instructions in your page file and make sure the correct styles have been applied;
If your styles aren't rendered correctly, make sure Astro has been successfully installed into your project tree and
astro.css
is correctly imported.
Although our CSS variables are available in the bundle, it's important to emphasize that you should use Astro classes whenever possible, instead of using the variables directly. Always look for the element you're creating in the docs before you start to build it from scratch.
In other words, avoid this:
.paragraph {
font-family: var(--font-primary);
font-weight: 600;
font-size: 24px;
line-height: 1.5;
color: var(--color-moon-900);
}
<p class="paragraph">Don't do this</p>
In the example above, all these properties could be replaced with using the a-text--large
class in the paragraph
element. Like so:
<p class="a-text--large">Do this!</p>
Customizing styles
In case you absolutely have to customize one or more properties in an Astro component, you should still use the corresponding Astro class that's closer to your goal and override it with your custom properties. You can do this:
.my-paragraph {
color: var(--color-moon-700); /* override default Astro color */
}
<p class="a-text--large my-paragraph">Customize like this</p>
Contributing
It's awesome that you want to contribute to Astro! Please see CONTRIBUTING.md to learn how it works.
Troubleshooting
- If you copy the markup from an example in our documentation, don't forget to change the attributes "className" to "class" and "htmlFor" to "for" if you're not in a React environment like our docs are.
Contact us
Found a bug? Please see if it was already reported on our issues page. If you can't find a matching report, you can open a new issue including as much information as you can gather. We appreciate it!
Any lingering questions? You can contact us at [email protected].
Thank you for using Astro! 🎉