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

chore(Storybook): New UI for Storybook #926

Merged
merged 11 commits into from
Nov 17, 2023
103 changes: 103 additions & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<style type="text/css">
/* styles for the storybook sidebar */
.search-result-item {
border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are all those !important needed? There isn't any official way of customizing these storybook styles?

I'm afraid a future update of storybook could break this

Copy link
Contributor Author

@yceballost yceballost Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed !important tag from the most of cases. The cases with !important needs it to force override the styles :(

}
.search-result-item--label span {
margin-top: 4px !important;
}
.sidebar-item,
.search-result-item {
padding-top: 0.875em !important;
padding-bottom: 0.875em !important;
font-size: 14px !important;
font-weight: 400 !important;
line-height: normal !important;
display: flex !important;
align-items: center !important;
}
.sidebar-item:first-of-type {
border-bottom: none !important;
}

/* let flex and align-items control alignment */
.sidebar-item > span,
.sidebar-item > svg {
margin-top: 0 !important;
}

/* icon size */
.sidebar-svg-icon,
.sidebar-item svg,
.search-result-item svg {
width: 4px !important;
height: 4px !important;
color: inherit !important;
opacity: 0 !important; /* hide icon to keep aligment with the rest of list elements */
yceballost marked this conversation as resolved.
Show resolved Hide resolved
}

/* www should be in lowercase */
.sidebar-item#www {
text-transform: lowercase;
}

/* create illusion of hrs between sidebar sections */
.sidebar-item#www,
.sidebar-item#appendix {
border-top: 2px solid rgba(0, 0, 0, 0.1);
margin-top: 0.5rem;
padding-top: 1rem !important;
}

/* logo placement tweaks */
.sidebar-header > div {
margin-right: 0 !important;
}
.sidebar-header a {
margin: 6px 0 !important;
}
.sidebar-header img {
width: 104px !important;
}
.sidebar-subheading {
border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}
.sidebar-subheading:last-child {
border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
padding-bottom: 16px !important;
}
.sidebar-subheading button,
.search-result-recentlyOpened {
letter-spacing: normal !important;
margin-top: 16px !important;
}
.sidebar-subheading span {
margin-right: 12px !important;
}

/* Search input */
.search-field input {
height: 40px !important;
padding-left: 32px !important;
}
.search-field svg:nth-child(1) {
top: 14px !important;
left: 14px !important;
}
.search-field svg:nth-child(4) {
top: 12px !important;
right: 13px !important;
}
.search-field code {
top: 12px !important;
right: 13px !important;
}

/* Main block */
[role='main'] > div {
border: 1px solid rgba(0, 0, 0, 0.1) !important;
border-radius: 0 !important;
box-shadow: none !important;
box-sizing: content-box !important;
}
</style>
3 changes: 3 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ import {createStorybookTheme} from './storybook-manager-theme';
addons.setConfig({
panelPosition: 'right',
theme: createStorybookTheme('Movistar'),
toolbar: {
title: {hidden: true},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hides this element
Screenshot 2023-10-26 at 18 09 52

},
});
6 changes: 5 additions & 1 deletion .storybook/storybook-manager-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const createStorybookTheme = (skinName) => {
return create({
base: 'light',

brandTitle: 'Mistica',
brandTitle: 'Mística',
brandUrl: 'https://github.com/Telefonica/mistica',
brandImage: logo,

Expand All @@ -28,5 +28,9 @@ export const createStorybookTheme = (skinName) => {
// Toolbar default and active colors
barTextColor: colors.textSecondary,
barSelectedColor: colors.primary,

// UI
appBg: '#ffffff',
appContentBg: '#ffffff',
});
};