Skip to content

feat(message-card): build message card#5068

Merged
lhbrennan merged 27 commits intomasterfrom
message-card
Aug 11, 2022
Merged

feat(message-card): build message card#5068
lhbrennan merged 27 commits intomasterfrom
message-card

Conversation

@lhbrennan
Copy link
Contributor

Description

New MessageCard component

Scope

Minor: New Feature

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 29, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d5ded55:

Sandbox Source
Basic usage Configuration

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 29, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 35d6bc0
Status: ✅  Deploy successful!
Preview URL: https://c8411b27.baseweb.pages.dev
Branch Preview URL: https://message-card.baseweb.pages.dev

View logs

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5069

it does not pass accessibility contrast tests for either white or black text.`
);
}
if (LIGHT_COLORS.includes(backgroundColor)) {
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 thought about using a map instead of an array for LIGHT_COLORS and DARK_COLORS so I can get constant time lookup here. Seems like the performance gain is negligible, but let me know if you disagree.

Copy link
Collaborator

Choose a reason for hiding this comment

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

try using a Set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, great idea!

overrides?: MessageCardOverridesT,
};

export type StyledRoot = StyletronComponent<
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'm not entirely confident that these exports at the bottom here are correctly typed -- please take a close look.

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
export const BACKGROUND_COLOR_TYPE = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BACKGROUND_COLOR_TYPE is bulky. Welcoming suggestions for alternate ways to name this constant.

export { default as MessageCard } from './message-card';
export * from './constants';
export * from './styled-components';
export * from './types';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

MessageCard uses the secondary and tertiary values from the Button's KIND constant. Does it make sense to duplicate that constant in MessageCard's constants.ts file and expose it? Or should devs using MessageCard import the KIND constant from baseui/button?

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 ended up creating a BUTTON_KIND constant to export from MessageCard. I couldn't get the docs site working otherwise.

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

onClick: (a: SyntheticEvent<HTMLButtonElement>) => unknown;
heading?: string;
paragraph?: string;
buttonLabel?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Design uses the word "Call to Action" instead of "Button". Semantically, "Call to Action" is more accurate since the entire MessageCard surface is a tap target, whereas the button itself is inert. But it seems to me that anyone familiar with Base Web would think of this element as "Button" since it does use the Base Web Button component. Open to suggestions.

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

2 similar comments
@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

1 similar comment
@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

Cloudflare was failing to build due to node running out of memory
@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5070

Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com>
@lhbrennan lhbrennan marked this pull request as ready for review August 9, 2022 20:42
@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #5085

Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com>
it does not pass accessibility contrast tests for either white or black text.`
);
}
if (LIGHT_COLORS.includes(backgroundColor)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

try using a Set

@lhbrennan lhbrennan merged commit a6a7281 into master Aug 11, 2022
@lhbrennan lhbrennan deleted the message-card branch August 11, 2022 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants