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

Component: @phase2/outline-core-button #410

Open
wants to merge 20 commits into
base: next
Choose a base branch
from

Conversation

bardleb
Copy link

@bardleb bardleb commented Aug 1, 2023

Summary by CodeRabbit

  • New Features

    • Introduced a new OutlineCoreButton component with customizable variants and sizes.
    • Added a search bar to the main interface for enhanced navigation.
    • Implemented a pre-commit hook to ensure code quality.
  • Enhancements

    • Updated button styling with new CSS variables for primary, secondary, tertiary, and link variants.
    • Improved button responsiveness and added new sizing options.
  • Bug Fixes

    • Removed unused tailwind.css import to streamline styles.
  • Documentation

    • Added comprehensive documentation for the OutlineCoreButton component in Storybook.
    • Updated CHANGELOGs for various packages to reflect new additions and changes.
  • Refactor

    • Renamed AdoptedStylesheets to AdoptedStyleSheets for consistency.
  • Style

    • Reformatted Storybook CSS for better readability and maintenance.
  • Chores

    • Deprecated the original button component in favor of the new OutlineCoreButton.

@changeset-bot
Copy link

changeset-bot bot commented Aug 1, 2023

⚠️ No Changeset found

Latest commit: 6e861ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Aug 1, 2023

Deploy Preview for outlinejs ready!

Name Link
🔨 Latest commit 6e861ad
🔍 Latest deploy log https://app.netlify.com/sites/outlinejs/deploys/65c2408526cae30008de5cbf
😎 Deploy Preview https://deploy-preview-410--outlinejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@himerus himerus marked this pull request as draft August 3, 2023 13:08
@socket-security
Copy link

socket-security bot commented Aug 8, 2023

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@phase2/[email protected] None 0 0 B
npm/@phase2/[email protected] None +1 441 kB himerus
npm/[email protected] None +6 282 MB turbobot

🚮 Removed packages: npm/[email protected]

View full report↗︎

@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2023

Walkthrough

The changes involve updates to a button component library, including the introduction of new CSS variables for styling various button variants, the addition of new button components, and updates to existing button components. The updates include modifications to button styles, sizes, and states, as well as the introduction of new properties and methods in TypeScript files. Documentation and Storybook stories have been updated to reflect these changes, including deprecation notices and new usage examples.

Changes

File(s) Summary
.husky/pre-commit Added a shell script to call lefthook with different arguments based on available executables.
.storybook/storybook.css Removed import of tailwind.css, indicating a move away from global Tailwind utilities.
packages/.../outline-core-button/CHANGELOG.md Introduced @phase2/outline-core-button with version 0.0.1.
packages/.../outline-core-button/index.ts Exported OutlineCoreButton, ButtonVariant, and ButtonSize from the module.
packages/.../outline-core-button/src/css-variables/vars-*.css Added default CSS variables for various button variants (default, link, primary, secondary, tertiary).
packages/.../outline-core-button/src/outline-core-button*.css Updated button styles, including padding, border-radius, colors, and sizes.
packages/.../outline-core-button/src/outline-core-button.ts Added imports, types, properties, and methods to OutlineCoreButton class.
packages/.../outline-extended-button/index.ts Exported OutlineExtendedButton component.
packages/.../outline-extended-button/outline-extended-button*.css Updated CSS styles for OutlineExtendedButton with new classes and properties.
packages/.../outline-extended-button/outline-extended-button.ts Modified imports, added new button variant, and extended OutlineCoreButton.
packages/.../adopted-stylesheets/README.md Updated import statement to reflect module renaming.
packages/.../outline-storybook/config/storybook.main.css Reformatted code and added new CSS variables.
packages/.../outline-storybook/stories/components/outline-button.stories.ts Marked original button component as deprecated.
packages/.../outline-storybook/stories/components/outline-core-button.stories.ts Added new Storybook stories for button components with various configurations.
packages/.../outline-storybook/stories/components/outline-core-button.stories.mdx Added new documentation and examples for outline-core-button.
packages/.../controllers/adopted-stylesheets/CHANGELOG.md Updated version information for outline-adopted-stylesheets-controller.
packages/.../documentation/outline-storybook/CHANGELOG.md Updated version information for outline-core-button.

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@glitchgirl glitchgirl changed the title feat: outline-core-button WIP feat: outline-core-button Oct 24, 2023
@glitchgirl glitchgirl marked this pull request as ready for review October 24, 2023 14:27
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 9

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3005e66 and d33e664.
Files ignored due to filter (6)
  • package-lock.json
  • packages/components/outline-core-button/package.json
  • packages/components/outline-core-button/tsconfig.build.json
  • packages/components/outline-extended-button/package.json
  • packages/components/outline-extended-button/tsconfig.build.json
  • yarn.lock
Files selected for processing (19)
  • .husky/pre-commit (1 hunks)
  • .storybook/storybook.css (1 hunks)
  • packages/components/outline-core-button/CHANGELOG.md (1 hunks)
  • packages/components/outline-core-button/index.ts (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-default.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-link.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-primary.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-secondary.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-tertiary.css (1 hunks)
  • packages/components/outline-core-button/src/outline-core-button.css (1 hunks)
  • packages/components/outline-core-button/src/outline-core-button.lightdom.css (1 hunks)
  • packages/components/outline-core-button/src/outline-core-button.ts (1 hunks)
  • packages/components/outline-extended-button/index.ts (1 hunks)
  • packages/components/outline-extended-button/outline-extended-button-lightdom.css (1 hunks)
  • packages/components/outline-extended-button/outline-extended-button.css (1 hunks)
  • packages/components/outline-extended-button/outline-extended-button.ts (1 hunks)
  • packages/controllers/adopted-stylesheets/README.md (1 hunks)
  • packages/documentation/outline-storybook/config/storybook.main.css (3 hunks)
  • packages/documentation/outline-storybook/stories/components/outline-core-button.stories.ts (1 hunks)
Files skipped from review due to trivial changes (15)
  • .husky/pre-commit
  • .storybook/storybook.css
  • packages/components/outline-core-button/CHANGELOG.md
  • packages/components/outline-core-button/index.ts
  • packages/components/outline-core-button/src/css-variables/vars-default.css
  • packages/components/outline-core-button/src/css-variables/vars-link.css
  • packages/components/outline-core-button/src/css-variables/vars-primary.css
  • packages/components/outline-core-button/src/css-variables/vars-secondary.css
  • packages/components/outline-core-button/src/outline-core-button.css
  • packages/components/outline-core-button/src/outline-core-button.lightdom.css
  • packages/components/outline-extended-button/index.ts
  • packages/components/outline-extended-button/outline-extended-button-lightdom.css
  • packages/components/outline-extended-button/outline-extended-button.css
  • packages/controllers/adopted-stylesheets/README.md
  • packages/documentation/outline-storybook/config/storybook.main.css
Additional comments: 8
packages/components/outline-core-button/src/css-variables/vars-tertiary.css (1)
  • 38-73: The CSS variables are being computed using the var() function with a fallback value. This is a good practice as it ensures that there will always be a value for these variables even if the primary variable is not defined. However, it's important to ensure that the fallback values are sensible defaults for your application.
packages/components/outline-extended-button/outline-extended-button.ts (2)
  • 12-12: The 'shiny' variant is being added to buttonVariantsTypes without any corresponding styles being defined. Ensure that the styles for this variant are defined and included in the component's styles.

  • 27-27: The AdoptedStyleSheets instance is being created with globalStyles, but these styles are not included in the static styles property. If these styles are meant to be applied globally, they should be included in the static styles property. If they are meant to be applied only to this component, they should be included in componentStyles.

packages/components/outline-core-button/src/outline-core-button.ts (5)
  • 33-33: The linkVars CSSResultGroup is included in the styles of OutlineCoreButton but it's not clear how it's being used in this component. If it's not used, it should be removed to avoid unnecessary imports and potential confusion.

  • 36-36: The buttonsVariantList state variable is declared but not used anywhere in the component. If it's not needed, it should be removed to avoid unnecessary state management and potential confusion.

  • 38-42: The AdoptedStyleSheets instance is created in the connectedCallback method and added to the controller. This is a good practice for managing styles in Web Components, but it's not clear how the AdoptedStyleSheets instance is used in this component. If it's not used, it should be removed to avoid unnecessary instantiation and potential confusion.

  • 106-123: The render method modifies the classes of a slotted button element based on the component's properties. This is a good practice for managing styles in Web Components, but it's not clear how the slotted button element is used in this component. If it's not used, this code should be removed to avoid unnecessary DOM manipulation and potential confusion.

  • 133-140: The updated method sets the aria-disabled attribute based on the is-disabled attribute. This is a good practice for managing accessibility in Web Components, but it's not clear how the aria-disabled attribute is used in this component. If it's not used, this code should be removed to avoid unnecessary attribute manipulation and potential confusion.

Comment on lines 11 to 36
/*
--outline-button--tertiary-padding
--outline-button--tertiary-radius
--outline-button--tertiary-padding
--outline-button--tertiary-radius
--outline-button--tertiary-bg-color
--outline-button--tertiary-text-color
--outline-button--tertiary-weight
--outline-button--tertiary-ring
--outline-button--tertiary-bg-color-hover
--outline-button--tertiary-text-color-hover
--outline-button--tertiary-weight-hover
--outline-button--tertiary-ring-hover
--outline-button--tertiary-bg-color-focus
--outline-button--tertiary-text-color-focus
--outline-button--tertiary-weight-focus
--outline-button--tertiary-ring-focus
--outline-button--tertiary-disabled-bg-color
--outline-button--tertiary-disabled-text-color
--outline-button--tertiary-disabled-weight
--outline-button--tertiary-disabled-ring
--outline-button--tertiary-disabled-bg-color-focus
--outline-button--tertiary-disabled-text-color-focus
--outline-button--tertiary-disabled-weight-focus
--outline-button--tertiary-disabled-ring-focus
*/
Copy link

Choose a reason for hiding this comment

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

The CSS variables are declared in the comments but not assigned any values. This could lead to confusion for developers who are trying to understand or modify the code. It would be better to assign default values to these variables in the comments, or remove the comments if they are not necessary.

?is-disabled=${isDisabled}
>
${defaultSlot}
</outline-core-button>
Copy link

Choose a reason for hiding this comment

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

The closing tag should be </outline-extended-button> instead of </outline-core-button>.

- </outline-core-button>
+ </outline-extended-button>
Committable suggestion (Beta)
Suggested change
</outline-core-button>
</outline-extended-button>

<div class="my-6">
<outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-size="large" button-label="Large Link"><button>Large Link</button></outline-core-button>
<outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-label="Link"><button>Link</button></outline-core-button>
<outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-size="small" button-label="Small Link"><button>Small Link<button></outline-core-button>
Copy link

Choose a reason for hiding this comment

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

The closing tag for the button element is misplaced. It should be placed immediately after the button text "Small Link".

- <outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-size="small" button-label="Small Link"><button>Small Link<button></outline-core-button>
+ <outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-size="small" button-label="Small Link"><button>Small Link</button></outline-core-button>
Committable suggestion (Beta)
Suggested change
<outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-size="small" button-label="Small Link"><button>Small Link<button></outline-core-button>
<outline-core-button class="mr-2 mb-4" button-variant="tertiary" button-url="#" button-size="small" button-label="Small Link"><button>Small Link</button></outline-core-button>

import "@phase2/outline-core-button";
// Import @phase2 version breaking Storybook
// import { buttonVariantsTypes } from "@phase2/outline-core-button/src/outline-core-button";
import { buttonVariantsTypes } from "../outline-core-button/src/outline-core-button";
Copy link

Choose a reason for hiding this comment

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

The import path seems to be incorrect. It's importing from a relative path that goes into the src directory of another package. This could lead to issues if the structure of the outline-core-button package changes. It's better to expose buttonVariantsTypes from the main entry point of the outline-core-button package.

- import { buttonVariantsTypes } from "../outline-core-button/src/outline-core-button";
+ import { buttonVariantsTypes } from "@phase2/outline-core-button";
Committable suggestion (Beta)
Suggested change
import { buttonVariantsTypes } from "../outline-core-button/src/outline-core-button";
import { buttonVariantsTypes } from "@phase2/outline-core-button";


@customElement('outline-extended-button')
export class OutlineExtendedButton extends OutlineCoreButton {
static styles: CSSResultGroup = [componentStyles];
Copy link

Choose a reason for hiding this comment

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

Only componentStyles are being included in the static styles property. If there are global styles that should be applied to this component, they should be included here as well.

- static styles: CSSResultGroup = [componentStyles];
+ static styles: CSSResultGroup = [componentStyles, globalStyles];
Committable suggestion (Beta)
Suggested change
static styles: CSSResultGroup = [componentStyles];
static styles: CSSResultGroup = [componentStyles, globalStyles];

@customElement('outline-extended-button')
export class OutlineExtendedButton extends OutlineCoreButton {
static styles: CSSResultGroup = [componentStyles];
AdoptedStyleSheets: AdoptedStyleSheets;
Copy link

Choose a reason for hiding this comment

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

The AdoptedStyleSheets property should be private and follow the camelCase naming convention for instance variables.

- AdoptedStyleSheets: AdoptedStyleSheets;
+ private adoptedStyleSheets: AdoptedStyleSheets;
Committable suggestion (Beta)
Suggested change
AdoptedStyleSheets: AdoptedStyleSheets;
private adoptedStyleSheets: AdoptedStyleSheets;

Comment on lines 65 to 75
@property({
type: String,
attribute: 'button-variant',
converter: buttonVariant => {
if (buttonVariant && !Object.values(buttonVariantsTypes).includes(buttonVariant)) {
buttonVariant = buttonVariantsTypes[0];
}
return buttonVariant;
},
})
buttonVariant: ButtonVariant;
Copy link

Choose a reason for hiding this comment

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

The buttonVariant property has a converter that checks if the provided value is one of the allowed variants. If it's not, it defaults to the first variant in the list. This is a good practice for ensuring valid property values, but the converter doesn't actually set the property value. It should return the new value to ensure the property is updated correctly.

  @property({
    type: String,
    attribute: 'button-variant',
    converter: buttonVariant => {
        if (buttonVariant && !Object.values(buttonVariantsTypes).includes(buttonVariant)) {
          buttonVariant = buttonVariantsTypes[0];
        }
-       return buttonVariant;
+       return buttonVariant || buttonVariantsTypes[0];
    },
  })
  buttonVariant: ButtonVariant;
Committable suggestion (Beta)
Suggested change
@property({
type: String,
attribute: 'button-variant',
converter: buttonVariant => {
if (buttonVariant && !Object.values(buttonVariantsTypes).includes(buttonVariant)) {
buttonVariant = buttonVariantsTypes[0];
}
return buttonVariant;
},
})
buttonVariant: ButtonVariant;
@property({
type: String,
attribute: 'button-variant',
converter: buttonVariant => {
return buttonVariant && Object.values(buttonVariantsTypes).includes(buttonVariant)
? buttonVariant
: buttonVariantsTypes[0];
},
})
buttonVariant: ButtonVariant;

Comment on lines 80 to 90
@property({
type: String,
attribute: 'button-size',
converter: buttonSize => {
if (buttonSize && !Object.values(buttonSizeTypes).includes(buttonSize)) {
buttonSize = buttonSizeTypes[0];
}
return buttonSize;
},
})
buttonSize: ButtonSize;
Copy link

Choose a reason for hiding this comment

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

The buttonSize property has a similar issue as the buttonVariant property. The converter should return the new value to ensure the property is updated correctly.

  @property({
    type: String,
    attribute: 'button-size',
    converter: buttonSize => {
        if (buttonSize && !Object.values(buttonSizeTypes).includes(buttonSize)) {
          buttonSize = buttonSizeTypes[0];
        }
-       return buttonSize;
+       return buttonSize || buttonSizeTypes[0];
    },
  })
  buttonSize: ButtonSize;
Committable suggestion (Beta)
Suggested change
@property({
type: String,
attribute: 'button-size',
converter: buttonSize => {
if (buttonSize && !Object.values(buttonSizeTypes).includes(buttonSize)) {
buttonSize = buttonSizeTypes[0];
}
return buttonSize;
},
})
buttonSize: ButtonSize;
@property({
type: String,
attribute: 'button-size',
converter: buttonSize => {
return buttonSize && Object.values(buttonSizeTypes).includes(buttonSize)
? buttonSize
: buttonSizeTypes[0];
},
})
buttonSize: ButtonSize;

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 5

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d33e664 and da9f578.
Files ignored due to filter (1)
  • yarn.lock
Files selected for processing (10)
  • packages/components/outline-core-button/src/css-variables/vars-default.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-link.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-primary.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-secondary.css (1 hunks)
  • packages/components/outline-core-button/src/css-variables/vars-tertiary.css (1 hunks)
  • packages/components/outline-core-button/src/outline-core-button.css (1 hunks)
  • packages/components/outline-core-button/src/outline-core-button.lightdom.css (1 hunks)
  • packages/components/outline-core-button/src/outline-core-button.ts (1 hunks)
  • packages/documentation/outline-storybook/stories/components/outline-button.stories.ts (1 hunks)
  • packages/documentation/outline-storybook/stories/components/outline-core-button.stories.ts (1 hunks)
Files skipped from review due to trivial changes (6)
  • packages/components/outline-core-button/src/css-variables/vars-default.css
  • packages/components/outline-core-button/src/css-variables/vars-primary.css
  • packages/components/outline-core-button/src/css-variables/vars-secondary.css
  • packages/components/outline-core-button/src/css-variables/vars-tertiary.css
  • packages/components/outline-core-button/src/outline-core-button.css
  • packages/components/outline-core-button/src/outline-core-button.lightdom.css
Additional comments: 4
packages/components/outline-core-button/src/css-variables/vars-link.css (1)
  • 1-83: The CSS variable definitions for the outline-core-button link variant are well-documented, follow a consistent naming convention, and use a computed pattern for default values. Ensure that the variables like --outline-transparent, --outline-gray-500, --outline-ring-inset, and --outline-ring-offset-width are defined elsewhere in the codebase for these computed defaults to work correctly.
packages/components/outline-core-button/src/outline-core-button.ts (1)
  • 109-127: The render method assumes that the slotted content is a button element, which may not always be the case. This could lead to unexpected behavior if other elements are slotted.
packages/documentation/outline-storybook/stories/components/outline-button.stories.ts (1)
  • 17-21: The title property of the default export has been updated to indicate that the original button component is now deprecated. This change should be clearly communicated to developers and stakeholders to ensure they are aware of the deprecation and can plan for any necessary refactoring or migration to the new button component.
packages/documentation/outline-storybook/stories/components/outline-core-button.stories.ts (1)
  • 17-17: The title property in the default export object does not reflect the deprecation of the original button component as mentioned in the summary. Please verify if the title should be updated to indicate deprecation.


// export type ButtonVariant = keyof typeof buttonVariantsTypes;
export type ButtonVariant = (typeof buttonVariantsTypes)[number];
export type ButtonSize = keyof typeof buttonSizeTypes;
Copy link

Choose a reason for hiding this comment

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

The ButtonSize type is incorrectly defined using keyof which is meant for object keys, not array values.

- export type ButtonSize = keyof typeof buttonSizeTypes;
+ export type ButtonSize = (typeof buttonSizeTypes)[number];

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
export type ButtonSize = keyof typeof buttonSizeTypes;
export type ButtonSize = (typeof buttonSizeTypes)[number];

@customElement('outline-core-button')
export class OutlineCoreButton extends OutlineElement {
static styles: CSSResultGroup = [linkVars, componentStyles];
AdoptedStyleSheets: AdoptedStyleSheets;
Copy link

Choose a reason for hiding this comment

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

The AdoptedStyleSheets property should be camelCased to follow JavaScript naming conventions.

- AdoptedStyleSheets: AdoptedStyleSheets;
+ adoptedStyleSheets: AdoptedStyleSheets;

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
AdoptedStyleSheets: AdoptedStyleSheets;
adoptedStyleSheets: AdoptedStyleSheets;

return buttonSize;
},
})
buttonSize: ButtonSize;
Copy link

Choose a reason for hiding this comment

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

The buttonSize property lacks a default value, which could lead to undefined behavior if it's not set.

- buttonSize: ButtonSize;
+ buttonSize: ButtonSize = 'medium'; // or whichever size is considered the default

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
buttonSize: ButtonSize;
buttonSize: ButtonSize = 'medium'; // or whichever size is considered the default

Comment on lines 136 to 143
updated() {
// TODO: Debug slot controller application.
// checks the is-disabled prop and manages aria-disabled attributes on the <outline-core-button> element itself.
if (this.hasAttribute('is-disabled')) {
this.setAttribute('aria-disabled', 'true');
} else {
this.setAttribute('aria-disabled', 'false');
}
Copy link

Choose a reason for hiding this comment

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

The updated method sets the aria-disabled attribute based on the presence of the is-disabled attribute, but it should check the property instead.

- if (this.hasAttribute('is-disabled')) {
+ if (this.isDisabled) {

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
updated() {
// TODO: Debug slot controller application.
// checks the is-disabled prop and manages aria-disabled attributes on the <outline-core-button> element itself.
if (this.hasAttribute('is-disabled')) {
this.setAttribute('aria-disabled', 'true');
} else {
this.setAttribute('aria-disabled', 'false');
}
updated() {
// TODO: Debug slot controller application.
// checks the is-disabled prop and manages aria-disabled attributes on the <outline-core-button> element itself.
if (this.isDisabled) {
this.setAttribute('aria-disabled', 'true');
} else {
this.setAttribute('aria-disabled', 'false');
}

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between da9f578 and ba20a64.
Files ignored due to filter (1)
  • yarn.lock
Files selected for processing (2)
  • packages/components/outline-core-button/src/css-variables/vars-tertiary.css (1 hunks)
  • packages/documentation/outline-storybook/stories/components/outline-core-button.stories.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/components/outline-core-button/src/css-variables/vars-tertiary.css
Additional comments: 1
packages/documentation/outline-storybook/stories/components/outline-core-button.stories.ts (1)
  • 17-17: The title should reflect the deprecation of the original button component as mentioned in the summary.

@@ -0,0 +1,290 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
Copy link

Choose a reason for hiding this comment

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

Reconsider the use of any type and try to use more specific types to improve type safety and maintainability.

story: `
## The \`primary\` variant.

This is the primary button style variant. It is used for buttons that behave like a button, but look like a Button, but is a button. Or a Button.
Copy link

Choose a reason for hiding this comment

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

The story description is confusing and may need rephrasing for clarity.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5777a40 and d8358c3.
Files ignored due to filter (5)
  • package.json
  • packages/components/outline-core-button/package.json
  • packages/controllers/adopted-stylesheets/package.json
  • packages/documentation/outline-storybook/package.json
  • yarn.lock
Files selected for processing (3)
  • packages/components/outline-core-button/CHANGELOG.md (1 hunks)
  • packages/controllers/adopted-stylesheets/CHANGELOG.md (1 hunks)
  • packages/documentation/outline-storybook/CHANGELOG.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/components/outline-core-button/CHANGELOG.md

Comment on lines +3 to +7
## 0.1.2

### Patch Changes

- Updates for outline-core-button.
Copy link

Choose a reason for hiding this comment

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

The changelog entry for version 0.1.2 only mentions "Updates for outline-core-button" without detailing the nature of the updates. Given the significant changes outlined in the PR summary, consider expanding this entry to include key changes such as new features, deprecations, and any breaking changes for better clarity and documentation.

Comment on lines +3 to +7
## 0.0.5

### Patch Changes

- Updates for outline-core-button.
Copy link

Choose a reason for hiding this comment

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

The changelog entry for version 0.0.5 mentions "Updates for outline-core-button" but lacks detail. Given the extensive changes to the outline-core-button component described in the PR objectives and summaries, consider adding more specific information about the nature of these updates, such as new features or breaking changes, especially the deprecation of the original button component.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d8358c3 and e6a12ad.
Files selected for processing (2)
  • packages/components/outline-core-button/src/outline-core-button.ts (1 hunks)
  • packages/documentation/outline-storybook/stories/components/outline-core-button.stories.mdx (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/components/outline-core-button/src/outline-core-button.ts

Comment on lines +43 to +45
<outline-core-button button-url="#" button-size="large" button-label="Large Button"><button>Large Button</button></outline-core-button>
<outline-core-button button-url="#" button-label="Button"><button>Button</button></outline-core-button>
<outline-core-button button-url="#" button-size="small" button-label="Small Button"><button>Small Button</button></outline-core-button>
Copy link

Choose a reason for hiding this comment

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

The button element inside the outline-core-button tag seems redundant and might not be necessary if outline-core-button is a custom element that should render its own button internally. Please verify if this is the intended usage or if it's a leftover from a previous implementation.

- <outline-core-button button-url="#" button-size="large" button-label="Large Button"><button>Large Button</button></outline-core-button>
- <outline-core-button button-url="#" button-label="Button"><button>Button</button></outline-core-button>
- <outline-core-button button-url="#" button-size="small" button-label="Small Button"><button>Small Button</button></outline-core-button>
+ <outline-core-button button-url="#" button-size="large" button-label="Large Button"></outline-core-button>
+ <outline-core-button button-url="#" button-label="Button"></outline-core-button>
+ <outline-core-button button-url="#" button-size="small" button-label="Small Button"></outline-core-button>

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
<outline-core-button button-url="#" button-size="large" button-label="Large Button"><button>Large Button</button></outline-core-button>
<outline-core-button button-url="#" button-label="Button"><button>Button</button></outline-core-button>
<outline-core-button button-url="#" button-size="small" button-label="Small Button"><button>Small Button</button></outline-core-button>
<outline-core-button button-url="#" button-size="large" button-label="Large Button"></outline-core-button>
<outline-core-button button-url="#" button-label="Button"></outline-core-button>
<outline-core-button button-url="#" button-size="small" button-label="Small Button"></outline-core-button>

@glitchgirl
Copy link
Contributor

TODO:
-review code rabbits typing suggestions
-remove pre-commit nonsense

@himerus himerus changed the title feat: outline-core-button Component: @phase2/outline-core-button Feb 6, 2024
@himerus himerus added Type: Component Suggestion Use this label for any issue that is a recommendation for a specific type of component. Why: Increase standardization NEW PACKAGE A Pull Request that creates a new NPM package to be released. labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Work NEW PACKAGE A Pull Request that creates a new NPM package to be released. Type: Component Suggestion Use this label for any issue that is a recommendation for a specific type of component. Why: Increase standardization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants