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

Updated button, alert card and back button stories #137

Merged
merged 2 commits into from
Oct 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"message": "Browse in my files",
"module": "core-common-component"
},
{"code": "PRIVACY_HEADER","message":" Privacy Policy for Admin Console","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "PRIVACY_HEADER","message":" Privacy Policy","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "PRIVACY_HEADER_1_SUB_1","message":"Introduction","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "DIGIT_TABLE_OF_CONTENTS","message":"Table of Contents","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "PRIVACY_HEADER_1_SUB_1_DESC_1","message":"This is the Privacy Policy for Admin Console","module":"digit-privacy-policy","locale":"en_MZ"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,52 @@ class IframeWidget extends StatelessWidget {
'''
(function() {
try {
// Find the tab list element
// Find the main content element
var mainContent = document.querySelector('.flex-1.relative.py-8.lg\\:px-12.break-anywhere.page-api-block\\:xl\\:max-2xl\\:pr-0.page-api-block\\:max-w-\\[1654px\\].page-api-block\\:mx-auto');
if (mainContent) {
// Remove all other elements from the body except the main content
var allChildren = Array.from(document.body.children);
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
allChildren.forEach(function(child) {
if (child !== mainContent) {
child.parentNode.removeChild(child);
}
});
console.log('Main content displayed, all other content removed.');
} else {
console.log('Main content not found, showing default content.');
}
// Tab switching logic
var tabList = document.querySelector('.group\\/tabs');
if (tabList) {
// Find all buttons inside the tab list
var buttons = tabList.querySelectorAll('button');
// If there are at least two buttons, switch the active class to the second button
if (buttons.length > 1) {
var firstButton = buttons[0];
var secondButton = buttons[1];
// Remove active class from the first button
if (firstButton.classList.contains('active-tab')) {
firstButton.classList.remove('active-tab');
}
// Add active class to the second button
if (!secondButton.classList.contains('active-tab')) {
secondButton.classList.add('active-tab');
}
// Optionally, trigger a click event on the second tab to ensure content loads
secondButton.click();
secondButton.click(); // Trigger content load for the second tab
console.log('Switched to second tab.');
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
} else {
console.log('Fallback: Only one button or no buttons found.');
}
} else {
console.log('Fallback: Tab list not found. Showing default content.');
}
} catch (error) {
console.error('Error occurred while switching tabs:', error);
console.error('Error occurred while processing the iframe content:', error);
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
}
})();
''',
Expand Down
6 changes: 3 additions & 3 deletions flutter/digit-ui-components/storybook/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
themeMode: ThemeMode.light,
theme: DigitExtendedTheme.instance.getLightTheme(),
darkTheme: DigitExtendedTheme.instance.getDarkTheme(),
locale: Locale("en", "MZ"),
Expand Down Expand Up @@ -133,7 +134,6 @@ class MyHomePageState extends State<MyHomePage> {
currentLocale: Locale("en", "MZ"), // Set the initial locale correctly
supportedLocales: {
"English": Locale.fromSubtags(languageCode: 'en', countryCode: 'MZ'),
"English (French)": Locale.fromSubtags(languageCode: 'en', countryCode: 'FR'),
},
delegates: [
DefaultMaterialLocalizations.delegate,
Expand Down Expand Up @@ -169,17 +169,17 @@ class MyHomePageState extends State<MyHomePage> {
...typographyStories(),
...accordionStories(),
...actionStories(),
...infoCardStories(),
...digitBackButtonStories(),
...DigitBreadCrumbStories(),
...DigitButtonStories(),
...buttonStories(),
...digitButtonListStories(),
...checkboxStories(),
...chipStories(),
...dividerStories(),
...dropdownStories(),
...fileUploaderStories(),
...inputFieldStories(),
...infoCardStories(),
...listViewStories(),
...loaderStories(),
...matrixCardStories(),
Expand Down
Loading