Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

draft css branch #704

Closed
wants to merge 2 commits into from
Closed

draft css branch #704

wants to merge 2 commits into from

Conversation

brianacnguyen
Copy link
Contributor

Description

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@brianacnguyen brianacnguyen requested a review from a team as a code owner May 24, 2024 16:04
@brianacnguyen brianacnguyen marked this pull request as draft May 24, 2024 16:04
@metamaskbot
Copy link
Collaborator

Builds ready [7d71150]

Storybook: Storybook

@metamaskbot
Copy link
Collaborator

Builds ready [f47acc5]

Storybook: Storybook

Copy link
Collaborator

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

Excellent work on the tests! I think this PR is moving in a good direction. A few points below:

  • Can we split this PR into two? One that tests the current CSS variables and another that adds the automation. I feel like they are two separate concerns.
  • I agree that it makes sense to have a utils folder inside src/. In the future, we may want to consolidate and move some of the functions from docs/ there if they are used in tests or if it makes sense to do so.
  • In the automation PR, can we move automation-scripts/brand-colors-css.js to scripts/brand-colors-css.js? I know you are following conventions from other PRs, but I think having an automation-scripts folder is redundant.

Comment on lines +12 to +19
it('should match JSON values', () => {
for (const [colorGroup, shades] of Object.entries(jsonData)) {
for (const [shade, details] of Object.entries(shades)) {
const variableName = `${colorGroup}-${shade}`;
expect(cssVariables[variableName]).toBe(details.value);
}
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice work added a console log to see what's happening here. LGTM!

Screenshot 2024-05-29 at 12 09 34 PM

import jsonData from '../figma/brandColors.json';

describe('CSS Variables', () => {
const cssFilePath = path.join(__dirname, 'generated-brand-colors.css');
Copy link
Collaborator

@georgewrmarshall georgewrmarshall May 29, 2024

Choose a reason for hiding this comment

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

Can we test the current brand color stylesheet here? Additionally, we should add more tests for the light and dark themes. It's fine to do this in separate PRs if that makes more sense. It would also be good to have tests for typography.

Suggested change
const cssFilePath = path.join(__dirname, 'generated-brand-colors.css');
const cssFilePath = path.join(__dirname, 'brand-colors.css');

import path from 'path';

import { getCssColorVariables } from '../../utils';
import jsonData from '../figma/brandColors.json';
Copy link
Collaborator

@georgewrmarshall georgewrmarshall May 29, 2024

Choose a reason for hiding this comment

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

Can we the first version of this PR test the current CSS variables against tokens.json?

Suggested change
import jsonData from '../figma/brandColors.json';
import jsonData from '../figma/tokens.json';

const cssVariables = getCssColorVariables(cssFilePath, 'brand-colors');

it('should match JSON values', () => {
for (const [colorGroup, shades] of Object.entries(jsonData)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Updating to get brand colors from current token json

Suggested change
for (const [colorGroup, shades] of Object.entries(jsonData)) {
for (const [colorGroup, shades] of Object.entries(
jsonData.global.brandColors,
)) {

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants