Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

help-beta: Use defaultClass instead of defaultStyle.

Shubham Padiabd935e07d877
diff --git a/help-beta/astro.config.mjs b/help-beta/astro.config.mjs
index 775e2f11f4b..8bee60e6ab8 100644
--- a/help-beta/astro.config.mjs
+++ b/help-beta/astro.config.mjs
@@ -12,11 +12,10 @@ export default defineConfig({
// eslint-disable-next-line new-cap
Icons({
compiler: "astro",
- // unplugin-icons sets height and width by itself.
- // It was setting the height to 1024 and 960 for some
- // icons. It is better to set the height explicitly.
- defaultStyle:
- "display: inline; vertical-align: text-bottom; height: 1em; width: 1em; margin-bottom: 0; margin-top: 0;",
+ // We need to override some default starlight behaviour to make
+ // icons look nice, see the css for this class to see the reasoning
+ // for each individual override of the default css.
+ defaultClass: "zulip-unplugin-icon",
customCollections: {
// unplugin-icons has a FileSystemIconLoader which is more
// versatile. But it only supports one directory path for
diff --git a/help-beta/src/styles/main.css b/help-beta/src/styles/main.css
index 7c766f41487..4c62f33dc48 100644
--- a/help-beta/src/styles/main.css
+++ b/help-beta/src/styles/main.css
@@ -33,6 +33,27 @@
padding: 1rem var(--sl-content-pad-x);
}
+.zulip-unplugin-icon {
+ /* Make sure the icon does not occupy it's own row. */
+ display: inline;
+ vertical-align: text-bottom;
+
+ /* unplugin-icons sets height and width by itself.
+ It was setting the height to 1024 and 960 for some
+ icons. It is better to set the height explicitly. */
+ height: 1em;
+ width: 1em;
+
+ /* Some css rules in starlight insert these margins to tags
+ that fit certain criteria, e.g. if it's a first child of
+ an li item and similar cases, and the icon disturbs the
+ spacing of everything around it just because it was an
+ svg tag. We set this explicitly to zero to avoid those
+ issues. */
+ margin-bottom: 0;
+ margin-top: 0;
+}
+
.sl-markdown-content {
img {
vertical-align: top;