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

storybook audit fixes for typography,hamburger and sidebar #142

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion react/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-components-css",
"version": "0.0.2-beta.39",
"version": "0.0.2-beta.40",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <jagan.kumar@egovernments.org>",
Expand Down
75 changes: 75 additions & 0 deletions react/css/src/digitv2/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,79 @@
&.paper-secondary{
background-color: theme(digitv2.lightTheme.paper-secondary);
}
}

.typography-story{
&.heading-m{
font-family: theme(digitv2.fontFamily.sans);
font-style: theme(digitv2.fontStyle.normal);
font-weight: theme(digitv2.fontWeight.bold);
line-height: theme(digitv2.lineHeight.lineheight1);

@media (max-aspect-ratio: 9/16) {
/* Media query for mobile */
font-size: theme(digitv2.fontSize.heading-m.mobile);
}

@media (min-aspect-ratio: 9/16) and (max-aspect-ratio: 3/4) {
/* Media query for tablets */
font-size: theme(digitv2.fontSize.heading-m.tablet);
}

@media (min-aspect-ratio: 3/4) {
/* Media query for desktop */
font-size: theme(digitv2.fontSize.heading-m.desktop);
}
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
}

&.heading-s {
font-family: theme(digitv2.fontFamily.sans);
font-style: theme(digitv2.fontStyle.normal);
font-weight: theme(digitv2.fontWeight.bold);
line-height: theme(digitv2.lineHeight.lineheight1);

@media (max-aspect-ratio: 9/16) {
/* Media query for mobile */
font-size: theme(digitv2.fontSize.heading-s.mobile);
}

@media (min-aspect-ratio: 9/16) and (max-aspect-ratio: 3/4) {
/* Media query for tablets */
font-size: theme(digitv2.fontSize.heading-s.tablet);
}

@media (min-aspect-ratio: 3/4) {
/* Media query for desktop */
font-size: theme(digitv2.fontSize.heading-s.desktop);
}
}
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved

&.body-s {
@media (max-aspect-ratio: 9/16) {
/* Media query for mobile */
font-size: theme(digitv2.fontSize.body-s.mobile);
font-family: theme(digitv2.fontFamily.sans);
font-style: theme(digitv2.fontStyle.normal);
font-weight: theme(digitv2.fontWeight.regular);
line-height: theme(digitv2.lineHeight.lineheight2);
}

@media (min-aspect-ratio: 9/16) and (max-aspect-ratio: 3/4) {
/* Media query for tablets */
font-size: theme(digitv2.fontSize.body-s.tablet);
font-family: theme(digitv2.fontFamily.sans);
font-style: theme(digitv2.fontStyle.normal);
font-weight: theme(digitv2.fontWeight.regular);
line-height: theme(digitv2.lineHeight.lineheight2);
}

@media (min-aspect-ratio: 3/4) {
/* Media query for desktop */
font-size: theme(digitv2.fontSize.body-s.desktop);
font-family: theme(digitv2.fontFamily.sans);
font-style: theme(digitv2.fontStyle.normal);
font-weight: theme(digitv2.fontWeight.regular);
line-height: theme(digitv2.lineHeight.lineheight2);
}
}
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 1 addition & 1 deletion react/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "webpack --mode production"
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.2-beta.49",
"@egovernments/digit-ui-components": "0.0.2-beta.50",
"@egovernments/digit-ui-libraries": "1.8.2-beta.1",
"@egovernments/digit-ui-module-common": "1.7.10",
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
Expand Down
2 changes: 1 addition & 1 deletion react/example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
rel='stylesheet' type='text/css'>
<link
rel="stylesheet"
href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.39/dist/index.css"
href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.40/dist/index.css"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
Expand Down
2 changes: 1 addition & 1 deletion react/modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.2-beta.49",
"@egovernments/digit-ui-components": "0.0.2-beta.50",
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion react/modules/sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-components": "0.0.2-beta.49",
"@egovernments/digit-ui-components": "0.0.2-beta.50",
"react": "17.0.2",
"react-date-range": "^1.4.0",
"react-dom": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@
"@babel/plugin-syntax-jsx": "^7.24.1",
"@babel/preset-react": "^7.24.1",
"@egovernments/digit-ui-libraries": "1.8.2-beta.1",
"@egovernments/digit-ui-components-css":"0.0.2-beta.39",
"@egovernments/digit-ui-components-css":"0.0.2-beta.40",
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-project": "0.3.4",
"@egovernments/digit-ui-module-sample": "0.0.1",
"@egovernments/digit-ui-react-components": "1.7.10",
"@egovernments/digit-ui-svg-components": "1.0.12",
"@egovernments/digit-ui-components": "0.0.2-beta.49",
"@egovernments/digit-ui-components": "0.0.2-beta.50",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "4.0.0",
"css-loader": "5.2.6",
Expand Down
2 changes: 1 addition & 1 deletion react/ui-components/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<head>
<!-- .storybook/preview-head.html -->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.39/dist/index.css"/>
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.40/dist/index.css"/>
<!-- Pull in static files served from your Static directory or the internet -->
<!-- Example: `main.js|ts` is configured with staticDirs: ['../public'] and your font is located in the `fonts` directory inside your `public` directory -->
<link rel="preload" href="/fonts/my-font.woff2" />
Expand Down
4 changes: 2 additions & 2 deletions react/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-components",
"version": "0.0.2-beta.49",
"version": "0.0.2-beta.50",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down Expand Up @@ -52,7 +52,7 @@
"dist"
],
"dependencies": {
"@egovernments/digit-ui-components-css": "0.0.2-beta.39",
"@egovernments/digit-ui-components-css": "0.0.2-beta.40",
"@egovernments/digit-ui-libraries": "1.8.1-beta.1",
"@egovernments/digit-ui-svg-components": "1.0.12",
"@googlemaps/js-api-loader": "1.13.10",
Expand Down
2 changes: 1 addition & 1 deletion react/ui-components/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.39/dist/index.css"/>
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.40/dist/index.css"/>
<link rel="icon" href="https://egov-dev-assets.s3.ap-south-1.amazonaws.com/browser-icon.png" />
<style>
.custom-class path {
Expand Down
12 changes: 12 additions & 0 deletions react/ui-components/src/atoms/BreadCrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const BreadCrumb = (props) => {
}
}, [props.crumbs, props.maxItems, expanded,props.itemsBeforeCollapse,props.itemsAfterCollapse,props?.expandText]);

function handleRedirect(path) {
const host = window.location.origin; // Dynamically get the base URL
window.location.href = `${host}${path}`;
}
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved

function isLast(index) {
let validcrumb = crumbsToDisplay?.filter((ob) => ob?.show === true)
return validcrumb?.findIndex((ob) => ob?.path === crumbsToDisplay?.[index]?.path) === validcrumb?.length - 1;
Expand Down Expand Up @@ -69,6 +74,13 @@ const BreadCrumb = (props) => {
{crumb?.icon && crumb.icon}
{crumb.content}
</span>
) : crumb?.externalPath ? (
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
<Link
className="digit-bread-crumb-content"
onClick={() => handleRedirect(crumb?.path)}>
{crumb?.icon && crumb.icon}
{crumb.content}
</Link>
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
) : (
<Link
to={{ pathname: crumb.path, state: { count: crumb?.count } }}
Expand Down
2 changes: 1 addition & 1 deletion react/ui-components/src/atoms/MobileSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const MobileSidebar = ({
)
}
<div className={`digit-msb-sidebar-bottom ${theme || ""}`}>
<Button onClick={onLogoutClick} label={t("Logout")} icon={"Logout"} variation={"secondary"} />
<Button onClick={onLogoutClick} label={t("Logout")} icon={"Logout"} variation={"secondary"} size={"medium"} />
</div>
</div>
) : null;
Expand Down
1 change: 1 addition & 0 deletions react/ui-components/src/atoms/MultiSelectDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ const MultiSelectDropdown = ({
: replacedText
: value?.propsData[1]?.[chipsKey]
}
hideClose={false}
onClick={
variant === "treemultiselect"
? () => onSelectToAddToQueue([value])
Expand Down
1 change: 1 addition & 0 deletions react/ui-components/src/atoms/UploadFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const UploadFile = (props) => {
<div className="digit-tag-container">
<Chip
key={index}
hideClose={false}
text={file[0].length > 64 ? `${file[0].slice(0, 64)} ...` : file[0]}
onClick={(e) => props?.removeTargetedFile(fileDetailsData, e)}
/>
Expand Down
1 change: 1 addition & 0 deletions react/ui-components/src/atoms/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ const Uploader = (props) => {
return (
<Chip
key={index}
hideClose={false}
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
text={file?.name}
onClick={(e) => {
e.stopPropagation();
Expand Down
115 changes: 115 additions & 0 deletions react/ui-components/src/atoms/stories/BodyTypography.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import React from "react";
import Divider from "../Divider";

export default {
title: "Foundations/Typography/Body",
argTypes: {
},
};
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved

const style = {
position: "absolute",
top: "50%",
left: "50%",
color: "#363636",
display: "flex",
justifyContent: "center",
transform: "translate(-50%, -50%)",
lineHeight: "normal",
};
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved

export const BodyL = () => (
<div
style={{
...style,
display: "flex",
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
justifyContent: "flex-start",
gap: "0.25rem",
flexDirection: "column",
}}
className={`typography body-l`}
>
<div
style={{
lineHeight: "normal",
display: "flex",
justifyContent: "flex-start",
gap: "0.25rem",
}}
>
Body L / 20pts
</div>
<Divider></Divider>
<div
style={{ lineHeight: "normal", color: "#363636" }}
className={`typography body-l`}
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore
</div>
</div>
);

export const BodyS = () => (
<div
style={{
...style,
display: "flex",
justifyContent: "flex-start",
gap: "0.25rem",
flexDirection: "column",
}}
className={`typography-story body-s`}
>
<div
style={{
lineHeight: "normal",
display: "flex",
justifyContent: "flex-start",
gap: "0.25rem",
}}
>
Body S / 16pts
</div>
<Divider></Divider>
<div
style={{ lineHeight: "normal", color: "#363636" }}
className={`typography-story body-s`}
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore
</div>
</div>
);

export const BodyXS = () => (
<div
style={{
...style,
display: "flex",
justifyContent: "flex-start",
gap: "0.25rem",
flexDirection: "column",
}}
className={`typography body-xs`}
>
<div
style={{
lineHeight: "normal",
display: "flex",
justifyContent: "flex-start",
gap: "0.25rem",
}}
>
Body XS / 14pts
</div>
<Divider></Divider>
<div
style={{ lineHeight: "normal", color: "#363636" }}
className={`typography body-xs`}
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore
</div>
</div>
);
Swathi-eGov marked this conversation as resolved.
Show resolved Hide resolved
Loading